Module: TTY::Option::Interface
- Defined in:
- lib/tty/option.rb
Instance Method Summary collapse
-
#help(**config, &block) ⇒ String
Provide a formatted help usage for the configured parameters.
-
#params ⇒ Object
The parsed parameters.
-
#parse(argv = ARGV, env = ENV, check_invalid_params: true, raise_on_parse_error: false) ⇒ Object
Parse command line arguments.
Instance Method Details
#help(**config, &block) ⇒ String
Provide a formatted help usage for the configured parameters
63 64 65 |
# File 'lib/tty/option.rb', line 63 def help(**config, &block) Formatter.help(self.class.parameters, self.class.usage, **config, &block) end |
#params ⇒ Object
The parsed parameters
37 38 39 |
# File 'lib/tty/option.rb', line 37 def params @__params ||= Params.create end |
#parse(argv = ARGV, env = ENV, check_invalid_params: true, raise_on_parse_error: false) ⇒ Object
Parse command line arguments
49 50 51 52 53 54 55 56 |
# File 'lib/tty/option.rb', line 49 def parse(argv = ARGV, env = ENV, check_invalid_params: true, raise_on_parse_error: false) parser = Parser.new(self.class.parameters, check_invalid_params: check_invalid_params, raise_on_parse_error: raise_on_parse_error) @__params = Params.create(*parser.parse(argv, env)) self end |