Module: Simple::CLI

Extended by:
Logger
Defined in:
lib/simple/cli.rb,
lib/simple/cli.rb,
lib/simple/cli/version.rb

Defined Under Namespace

Modules: Adapter, Helpers, Logger Classes: Runner

Constant Summary collapse

DEBUG =
true
VERSION =
"0.1.1"

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Logger

logger=

Class Method Details

.included(base) ⇒ Object



14
15
16
17
# File 'lib/simple/cli.rb', line 14

def self.included(base)
  base.extend(::Simple::CLI::Adapter)
  base.include(::Simple::CLI::Helpers)
end

Instance Method Details

#help(subcommand = nil) ⇒ Object

Print help on a subcommand



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

def help(subcommand = nil)
  # This method is a dummy. It is necessary to provide a stub for the purpose
  # of documentation - BUT THIS METHOD WILL NEVER BE CALLED.
end

#logger ⇒ Object



20
21
22
# File 'lib/simple/cli.rb', line 20

def logger
  Simple::CLI::Logger.logger
end

#run!(command, *args) ⇒ Object

Simple::CLI.run! is called from Runner.run. It is called with a method name, which is derived from the command passed in via the command line, and parsed arguments.

The default implementation just calls the respective method on self. Implementations might override this method to provide some before/after functionality.



31
32
33
# File 'lib/simple/cli.rb', line 31

def run!(command, *args)
  send(command, *args)
end