module Thor::RichOptions::Exclusive

Public Instance Methods

exclusive(*args, &block)
Alias for: method_exclusive
method_exclusive(*args, &block) click to toggle source

Adds and declareds option group for exclusive options in the block and arguments. You can declare options as the outside of the block. If :for is given as option, it allows you to change the options from a prvious defined command.

Parameters

Array

options<Hash>

:for is applied for previous defined command.

Examples

exclusive do
  option :one
  option :two
 end

Or

option :one
option :two
exclusive :one, :two

If you give “–one” and “–two” at the same time. ExclusiveArgumentsError will be raised.

# File lib/thor/rich_options/exclusive.rb, line 39
def method_exclusive(*args, &block)
  register_options_relation_for(:method_options,
                                :method_exclusive_option_names, *args, &block)
end
Also aliased as: exclusive
method_exclusive_option_names() click to toggle source

Returns this class exclusive options array set.

Rturns

Array[Array]

# File lib/thor/rich_options/exclusive.rb, line 10
def method_exclusive_option_names
  @method_exclusive_option_names ||=[]
end
print_exclusive_options(shell, command = nil) click to toggle source