Skip to content

use Slop "no-" prefix feature#121

Open
no6v wants to merge 2 commits intomasterfrom
slop-no-prefix
Open

use Slop "no-" prefix feature#121
no6v wants to merge 2 commits intomasterfrom
slop-no-prefix

Conversation

@no6v
Copy link
Copy Markdown
Collaborator

@no6v no6v commented May 3, 2012

Slop has a feature to invert the flag value with --no- prefix to each flag-like option,
so I tried to make options simple. If -n is specified, it will be treated it preferentially against
-l or --logo with deprecation warning.

Slop#to_hash on 3.x is broken as ever, but it will be fixed on 4.x anytime soon.
leejarvis/slop#59

* "-n" is marked as deprecated, but works preferentially
@jugyo
Copy link
Copy Markdown
Owner

jugyo commented May 3, 2012

I want to show the help like below:

  --[no-]stream       Stream mode

@no6v
Copy link
Copy Markdown
Collaborator Author

no6v commented May 3, 2012

I feel this should be as a function of Slop, but I tweaked the output of help.
Do not merge this at this time, thanks :).

@leejarvis
Copy link
Copy Markdown

opts = Slop.new do
  on 'bar', help: '  --[no-]bar   Stream mode'
end
puts opts.help #=> --[no-]bar   Stream mode

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

Successfully merging this pull request may close these issues.

3 participants