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

Options without dashes #14

Closed
rainerborene opened this issue Mar 20, 2011 · 1 comment
Closed

Options without dashes #14

rainerborene opened this issue Mar 20, 2011 · 1 comment
Labels

Comments

@rainerborene
Copy link

It's possible to create commands without dashes? For example: boo init something

Awesome gem BTW :-)

@leejarvis
Copy link
Owner

Slop is exclusively for parsing options and flags, so anything that doesn't have a - character prepended will be missed.

Using the destructive parse! method though, Slop will remove any items it parses and leave you with the items it ignored. For example:

Slop.parse! do
  opt :n, :name, true
end

p ARGV

When using foo --name bar baz ARGV will be left with ["foo", "baz"] so you can now test against values inside this Array. See the documentation for parse! here. There is also an example of this functionality inside of the Usage section of the README.

If you have any other questions please refrain from creating an issue and instead check the API documentation, or feel free to jump onto IRC (freenode) on #ruby-lang and ask me any questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants