You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The example d.rb claims that an option can be made mandatory with the #required method. Unfortunately it does not work.
Try the following example, it won't fail.
require 'main'
ARGV.replace %w()
Main {
option('foo', 'f'){
required # by default options are not required, we could use 'foo=foo'
# above as a shortcut
# argument_required
}
def run
p "Did you pass --foo ? #{params['foo'].given? == true}"
end
}
Output will be:
"Did you pass --foo ? false"
The text was updated successfully, but these errors were encountered:
The example d.rb claims that an option can be made mandatory with the #required method. Unfortunately it does not work.
Try the following example, it won't fail.
Output will be:
The text was updated successfully, but these errors were encountered: