Exception: Brut::CLI::InvalidOption
- Defined in:
- lib/brut/cli/error.rb
Overview
Raised when an OptionParser::ParseError
is caught to provide a more useful
error message given the global/command optiona dichotomy.
Instance Method Summary collapse
-
#initialize(option_parser_parse_error, context:) ⇒ InvalidOption
constructor
A new instance of InvalidOption.
Constructor Details
#initialize(option_parser_parse_error, context:) ⇒ InvalidOption
Returns a new instance of InvalidOption.
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/brut/cli/error.rb', line 25 def initialize(option_parser_parse_error, context:) args = option_parser_parse_error.args = if option_parser_parse_error.args.length == 1 "isn't a valid option" else "aren't valid options" end = if context.kind_of?(Class) "for the '#{context.command_name}' command" else "for the app globally" end super("#{args.join(", ")} #{} #{}") end |