Method: Puppet::Interface::OptionManager#add_option
- Defined in:
- lib/puppet/interface/option_manager.rb
#add_option(option) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/puppet/interface/option_manager.rb', line 49 def add_option(option) # @options collects the added options in the order they're declared. # @options_hash collects the options keyed by alias for quick lookups. ||= [] ||= {} option.aliases.each do |name| conflict = get_option(name) if conflict raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict}") % { option: option, conflict: conflict } end actions.each do |action| action = get_action(action) conflict = action.get_option(name) if conflict raise ArgumentError, _("Option %{option} conflicts with existing option %{conflict} on %{action}") % { option: option, conflict: conflict, action: action } end end end << option.name option.aliases.each do |name| [name] = option end return option end |