Class: Simple::CLI::DefaultOptions
- Inherits:
-
Object
- Object
- Simple::CLI::DefaultOptions
- Defined in:
- lib/simple/cli/default_options.rb
Overview
A DefaultOptions object holds values for default options.
Instance Attribute Summary collapse
-
#command ⇒ Object
readonly
command.
-
#log_level ⇒ Object
readonly
verbosity (one of ::Logger::WARN, ::Logger::INFO, ::Logger::DEBUG).
Instance Method Summary collapse
-
#extract!(args:) ⇒ Object
extract default CLI options and the “help” command.
-
#help? ⇒ Boolean
The help flag.
-
#verbose? ⇒ Boolean
returns true if we run in verbose mode.
Instance Attribute Details
#command ⇒ Object (readonly)
command
20 21 22 |
# File 'lib/simple/cli/default_options.rb', line 20 def command @command end |
#log_level ⇒ Object (readonly)
verbosity (one of ::Logger::WARN, ::Logger::INFO, ::Logger::DEBUG)
12 13 14 |
# File 'lib/simple/cli/default_options.rb', line 12 def log_level @log_level end |
Instance Method Details
#extract!(args:) ⇒ Object
extract default CLI options and the “help” command. Returns a DefaultOptions object
7 8 9 |
# File 'lib/simple/cli/default_options.rb', line 7 def extract!(args:) new args end |
#help? ⇒ Boolean
The help flag. Is set when
-
running the “help” command
-
when a “-h” or “–help” CLI flag was given.
26 27 28 |
# File 'lib/simple/cli/default_options.rb', line 26 def help? @help end |
#verbose? ⇒ Boolean
returns true if we run in verbose mode.
15 16 17 |
# File 'lib/simple/cli/default_options.rb', line 15 def verbose? log_level == ::Logger::DEBUG end |