Method: Bundler::Thor.method_at_least_one
- Defined in:
- lib/bundler/vendor/thor/lib/thor.rb
permalink .method_at_least_one(*args, &block) ⇒ Object Also known as: at_least_one
Adds and declares option group for required at least one of options in the block of 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 previous defined command.
Parameters
- options<Hash>
-
:for is applied for previous defined command.
Examples
at_least_one do
option :one
option :two
end
Or
option :one
option :two
at_least_one :one, :two
If you do not give “–one” and “–two” AtLeastOneRequiredArgumentError will be raised.
You can use at_least_one and exclusive at the same time.
exclusive do
at_least_one do
option :one
option :two
end
end
Then it is required either only one of “–one” or “–two”.
246 247 248 249 |
# File 'lib/bundler/vendor/thor/lib/thor.rb', line 246 def method_at_least_one(*args, &block) (:method_options, :method_at_least_one_option_names, *args, &block) end |