Module: SimpleScripting::Argv
Defined Under Namespace
Classes: ArgumentError, ExitWithArgumentsHelpPrinting, ExitWithCommandsHelpPrinting, InvalidCommand
Instance Method Summary collapse
Instance Method Details
#decode(*params_definition, arguments: ARGV, long_help: nil, auto_help: true, output: $stdout) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/simple_scripting/argv.rb', line 40 def decode(*params_definition, arguments: ARGV, long_help: nil, auto_help: true, output: $stdout) # WATCH OUT! @long_help can also be set in :decode_command!. See issue #17. # @long_help = long_help exit_data = catch(:exit) do if params_definition.first.is_a?(Hash) return decode_command!(params_definition, arguments, auto_help) else return decode_arguments!(params_definition, arguments, auto_help) end end exit_data.print_help(output, @long_help) nil # to be used with the 'decode(...) || exit' pattern ensure @long_help = nil end |