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

Allow leading hyphens for arguments #536

Merged

Conversation

MartinKavik
Copy link
Contributor

Fixes #534

This is one-line change, ignore the first two commits, I'll rebase it once #535 is merged.

This change allows to pass hyphenated arguments to tasks - e.g. makers my_task arg1 -arg2.

There are two ways to make it work:

  1. Allow hyphenated args globally with AppSettings::AllowLeadingHyphen
  2. Call Arg::allow_hyphen_values on Arg::with_name("TASK_ARGS")

The second option doesn't work (I don't know why) so I've chosen the first option in this PR.
Note: There are some warnings in the related doc comments. They look acceptable for me, but I recommend to look at them, maybe you'll find some surprising edge-cases that I don't see.

@sagiegurari sagiegurari self-assigned this Mar 29, 2021
@sagiegurari sagiegurari added this to the 0.32.15 milestone Mar 29, 2021
@sagiegurari sagiegurari changed the base branch from master to 0.32.15 March 29, 2021 16:35
@sagiegurari
Copy link
Owner

@MartinKavik cool. changes in clap always make me feel a bit uneasy. i hope it won't break other things.
I don't have a good way to test it either :(
so will run few manual tests and then merge it.

thanks again for all the fixes. feel free to push PRs anytime :)

@sagiegurari
Copy link
Owner

@MartinKavik merging. thanks a lot for this.

@sagiegurari sagiegurari merged commit d1c1e7e into sagiegurari:0.32.15 Mar 29, 2021
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.

Allow arguments with a dash
2 participants