Module: Nanoc::CLI Private

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

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Defined Under Namespace

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

Class Method Summary collapse

Class Method Details

.add_command(cmd) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Adds the given command to the collection of available commands.

Parameters:

  • cmd (Cri::Command)

    The command to add



60
61
62
# File 'lib/nanoc/cli.rb', line 60

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

.after_setup(&block) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

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



67
68
69
70
# File 'lib/nanoc/cli.rb', line 67

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

.debug=(boolean) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



34
35
36
# File 'lib/nanoc/cli.rb', line 34

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

.debug?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

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



24
25
26
# File 'lib/nanoc/cli.rb', line 24

def self.debug?
  @debug || false
end

.root_commandCri::Command

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns The root command, i.e. the command-line tool itself.

Returns:

  • (Cri::Command)

    The root command, i.e. the command-line tool itself



51
52
53
# File 'lib/nanoc/cli.rb', line 51

def self.root_command
  @root_command
end

.run(args) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Invokes the Nanoc command-line tool with the given arguments.

Parameters:

  • args (Array<String>)

    An array of command-line arguments



43
44
45
46
47
48
# File 'lib/nanoc/cli.rb', line 43

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