Module: Cuprum::Cli::Options::Verbose

Included in:
Commands::File::GenerateFile, Commands::File::NewCommand
Defined in:
lib/cuprum/cli/options/verbose.rb

Overview

Defines --verbose option, which enables optional console outputs.

Instance Method Summary collapse

Instance Method Details

#say(message, newline: true, quiet: false, verbose: false, **options) ⇒ nil

Prints a message to the output stream.

Parameters:

  • message (String)

    the message to print.

  • options (Hash)

    options for printing the message.

Options Hash (**options):

  • newline (true, false)

    if true, appends a newline to the message if the message does not end with a newline. Defaults to true.

  • quiet (true, false)

    if true, prints the message even if the command has the :quiet option enabled. Defaults to false. Ignored if the command does not support the :quiet option.

  • verbose (true, false)

    if true, prints the message only if the command has the :verbose option enabled. Defaults to false. Ignored if the command does not support the :verbose option.

Returns:

  • (nil)


26
27
28
29
30
# File 'lib/cuprum/cli/options/verbose.rb', line 26

def say(message, verbose: false, **)
  return if verbose && !options.fetch(:verbose, false)

  super
end