Module: Simple::CLI::Adapter
- Defined in:
- lib/simple/cli/adapter.rb
Overview
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/MethodLength rubocop:disable Metrics/PerceivedComplexity
Instance Method Summary collapse
- #logger ⇒ Object
- #logger=(logger) ⇒ Object
-
#run!(*argv) ⇒ Object
Run a Simple::CLI application.
Instance Method Details
#logger ⇒ Object
36 37 38 |
# File 'lib/simple/cli/adapter.rb', line 36 def logger Simple::CLI.logger end |
#logger=(logger) ⇒ Object
32 33 34 |
# File 'lib/simple/cli/adapter.rb', line 32 def logger=(logger) Simple::CLI.logger = logger end |
#run!(*argv) ⇒ Object
Run a Simple::CLI application
This is usually called with as either
-
Application::CLI.run!: runs the Application’s CLI with subcommand support.
or
-
Application::CLI.run!(“main”): runs the Application’s CLI without subcommand support.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/simple/cli/adapter.rb', line 16 def run!(*argv) if argv.length == 1 && argv != ARGV main_command = *argv end runner = Simple::CLI::Runner.new(self) if main_command && (ARGV.include?("--help") || ARGV.include?("-h")) runner.help(main_command) elsif main_command runner.run(main_command, *ARGV) else runner.run(*ARGV) end end |