Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot required argument-less option #26

Open
alexism opened this issue Sep 13, 2012 · 0 comments
Open

cannot required argument-less option #26

alexism opened this issue Sep 13, 2012 · 0 comments

Comments

@alexism
Copy link

alexism commented Sep 13, 2012

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"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant