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, dry_run: false, }.freeze
Class Method Summary collapse
-
.call(args = ARGV) ⇒ Array<Hash,Array,String,Hash>
Parses the command line arguments.
Instance Method Summary collapse
-
#call(args = ARGV) ⇒ Array<Hash,Array,String,Hash>
Parses the command line arguments.
Class Method Details
.call(args = ARGV) ⇒ Array<Hash,Array,String,Hash>
Parses the command line arguments. Shorthand for ArgsParser.new.call. This call is recommended to protect the caller in case this functionality is repackaged as a Module or otherwise modified.
31 32 33 |
# File 'lib/rika/cli/args_parser.rb', line 31 def self.call(args = ARGV) new.call(args) end |
Instance Method Details
#call(args = ARGV) ⇒ Array<Hash,Array,String,Hash>
Parses the command line arguments.
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/rika/cli/args_parser.rb', line 39 def call(args = ARGV) @args = args = DEFAULT_OPTIONS.dup prepend_environment_args @option_parser = create_option_parser option_parser.parse!(args) targets, issues = process_args_for_targets [, targets, option_parser.help, issues] end |