Module: Nanoc3::CLI

Defined in:
lib/nanoc3/cli.rb,
lib/nanoc3/cli/logger.rb,
lib/nanoc3/cli/command.rb,
lib/nanoc3/cli/error_handler.rb

Defined Under Namespace

Modules: Commands Classes: Command, ErrorHandler, Logger

Class Method Summary collapse

Class Method Details

.add_command(cmd) ⇒ void

This method returns an undefined value.

Adds the given command to the collection of available commands.

Parameters:

  • cmd (Cri::Command)

    The command to add



49
50
51
# File 'lib/nanoc3/cli.rb', line 49

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

.debug=(boolean) ⇒ void

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



27
28
29
# File 'lib/nanoc3/cli.rb', line 27

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

.debug?Boolean

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



17
18
19
# File 'lib/nanoc3/cli.rb', line 17

def self.debug?
  @debug || false
end

.run(args) ⇒ void

This method returns an undefined value.

Invokes the nanoc commandline tool with the given arguments.

Parameters:

  • args (Array<String>)

    An array of commandline arguments



36
37
38
39
40
41
42
# File 'lib/nanoc3/cli.rb', line 36

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