Module: GLI::CopyOptionsToAliases
Overview
Mixin that both GLI and Command can use to copy command-line options to the aliased versions of flags and switches
includers must provide the methods flags
and switches
that return an Array of Flag or Switch, respectively
Instance Method Summary collapse
-
#copy_options_to_aliases(options) ⇒ Object
For each option in options, copies its value to keys for the aliases of the flags or switches in gli_like.
Instance Method Details
#copy_options_to_aliases(options) ⇒ Object
For each option in options, copies its value to keys for the aliases of the flags or switches in gli_like
options - Hash of options parsed from command line; this is an I/O param
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/gli/copy_options_to_aliases.rb', line 13 def () # :nodoc: = {} .each do |key,value| if flags[key] && flags[key].aliases copy_aliases(flags[key].aliases,,value) elsif switches[key] && switches[key].aliases copy_aliases(switches[key].aliases,,value) end end .merge!() end |