Module: Nanoc::CLI

Defined in:
lib/nanoc/cli.rb,
lib/nanoc/cli/ansi_string_colorizer.rb,
lib/nanoc/cli/error_handler.rb,
lib/nanoc/cli/command_runner.rb,
lib/nanoc/cli/logger.rb,
lib/nanoc/cli/cleaning_stream.rb,
lib/nanoc/cli/stream_cleaners.rb

Defined Under Namespace

Modules: ANSIStringColorizer, Commands, StreamCleaners Classes: CleaningStream, CommandRunner, ErrorHandler, Logger

Constant Summary

Command =
Deprecated.

Use CommandRunner instead

CommandRunner

Class Method Summary (collapse)

Class Method Details

+ (void) add_command(cmd)

This method returns an undefined value.

Adds the given command to the collection of available commands.

Parameters:

  • cmd (Cri::Command)

    The command to add



73
74
75
# File 'lib/nanoc/cli.rb', line 73

def self.add_command(cmd)
  root_command.add_command(cmd)
end

+ (void) after_setup(&block)

This method returns an undefined value.

Schedules the given block to be executed after the CLI has been set up.



80
81
82
83
# File 'lib/nanoc/cli.rb', line 80

def self.after_setup(&block)
  # TODO decide what should happen if the CLI is already set up
  self.add_after_setup_proc(block)
end

+ (void) debug=(boolean)

This method returns an undefined value.

Parameters:

  • boolean (Boolean)

    true if debug output should be enabled, false if it should not

Since:

  • 3.2.0



47
48
49
# File 'lib/nanoc/cli.rb', line 47

def self.debug=(boolean)
  @debug = boolean
end

+ (Boolean) debug?

Returns true if debug output is enabled, false if not

Returns:

  • (Boolean)

    true if debug output is enabled, false if not

Since:

  • 3.2.0



37
38
39
# File 'lib/nanoc/cli.rb', line 37

def self.debug?
  @debug || false
end

+ (Cri::Command) root_command

Returns The root command, i.e. the commandline tool itself

Returns:

  • (Cri::Command)

    The root command, i.e. the commandline tool itself



64
65
66
# File 'lib/nanoc/cli.rb', line 64

def self.root_command
  @root_command
end

+ (void) run(args)

This method returns an undefined value.

Invokes the nanoc commandline tool with the given arguments.

Parameters:

  • args (Array<String>)

    An array of commandline arguments



56
57
58
59
60
61
# File 'lib/nanoc/cli.rb', line 56

def self.run(args)
  Nanoc::CLI::ErrorHandler.handle_while do
    setup
    root_command.run(args)
  end
end