Class: ArgsParser
- Inherits:
-
Object
- Object
- ArgsParser
- Defined in:
- lib/rika/cli/args_parser.rb
Overview
Processes the array of arguments (ARGV by default) and returns the options, targets, and help string.
Constant Summary collapse
- DEFAULT_OPTIONS =
{ as_array: false, format: 'at', # AwesomePrint for metadata, to_s for text content metadata: true, text: true, source: true, key_sort: true }.freeze
Class Method Summary collapse
-
.call(args = ARGV) ⇒ Array<Hash,String>
Parses the command line arguments.
Instance Method Summary collapse
-
#call(args = ARGV) ⇒ Array<Hash,String>
Parses the command line arguments.
Class Method Details
.call(args = ARGV) ⇒ Array<Hash,String>
Parses the command line arguments. Shorthand for ArgsParser.new.call. This call is recommended to pro tect the caller in case this functionality is repackaged as a Module or otherwise modified.
24 25 26 |
# File 'lib/rika/cli/args_parser.rb', line 24 def self.call(args = ARGV) new.call(args) end |
Instance Method Details
#call(args = ARGV) ⇒ Array<Hash,String>
Parses the command line arguments.
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/rika/cli/args_parser.rb', line 32 def call(args = ARGV) @args = args = DEFAULT_OPTIONS.dup prepend_environment_args @option_parser = create_option_parser option_parser.parse!(args) targets = create_target_array [, targets, option_parser.help] end |