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

feat(arg_aliases): Ability to alias arguments #674

Merged
merged 4 commits into from
Oct 4, 2016

Conversation

afiune
Copy link
Contributor

@afiune afiune commented Sep 30, 2016

There are some cases where you need to have an argument to have an
alias, an example could be when you deprecate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:

Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")

Closes #669

Also you can alias flags as follow:

Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")

@yo-bot
Copy link

yo-bot commented Sep 30, 2016

Thanks for the pull request, and welcome! The team is excited to review your changes, and you should hear from @Vinatorul (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@afiune
Copy link
Contributor Author

afiune commented Sep 30, 2016


This is the first iteration of this feature! 🎉

I am sharing it at this point so I can have some feedback. If this is something you guys are happy with let me know and if not, I am open to suggestions, comments, etc.

I will continue with some more testing and documentation!

@afiune afiune force-pushed the afiune/arg-aliases branch 3 times, most recently from a616a39 to f8b4c92 Compare October 3, 2016 15:48
@afiune
Copy link
Contributor Author

afiune commented Oct 3, 2016

Uhmm 🤔 I think the pipeline is broken, at least for windows since appveryor is not even compiling the binary, I wonder if I need to look into it? cc/ @Vinatorul @kbknapp

@tormol
Copy link
Contributor

tormol commented Oct 4, 2016

If you look at the travis details, the nightly failed too.
There was an issue with the previous "nightly", it was fixed on master five days ago, but there have not been a nightly since then until today.

Just close and reopen to trigger a rebuild.

@afiune afiune closed this Oct 4, 2016
@afiune afiune reopened this Oct 4, 2016
@afiune afiune force-pushed the afiune/arg-aliases branch 3 times, most recently from fa00436 to 771c4c7 Compare October 4, 2016 15:05
@afiune
Copy link
Contributor Author

afiune commented Oct 4, 2016

@tormol Thank you for that advice! 👍

The new nightly rust version has some new warning that I already fixed sooo we are green now! ✅

@kbknapp
Copy link
Member

kbknapp commented Oct 4, 2016

@afiune this looks great! Once #670 merges could you do a quick rebase onto master and this should be good for a merge!

@tormol thank for the assistance 😉

I've been traveling a lot lately so I haven't had much time, but I'm finally home 🎉

@afiune
Copy link
Contributor Author

afiune commented Oct 4, 2016

@kbknapp Fantastic! I'm on it!!

Salim Afiune added 4 commits October 4, 2016 12:26
There are some cases where you need to have an argument to have an
alias, an example could be when you depricate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:
```
Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")
```

Closes clap-rs#669
Signed-off-by: Salim Afiune <afiune@chef.io>
Added same alias funtionality for flags, now you can do:
```
Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")
```

Signed-off-by: Salim Afiune <afiune@chef.io>
The new version of rustc 1.14.0-nightly (144af3e97 2016-10-02) has new
linting warnings/errors. This commit fixes them.

Signed-off-by: Salim Afiune <afiune@chef.io>
@afiune
Copy link
Contributor Author

afiune commented Oct 4, 2016

@kbknapp Rebased and test passing.. I think we are ready to merge!!!

@kbknapp
Copy link
Member

kbknapp commented Oct 4, 2016

@homu r+

@homu
Copy link
Contributor

homu commented Oct 4, 2016

📌 Commit 905d3b9 has been approved by kbknapp

homu added a commit that referenced this pull request Oct 4, 2016
feat(arg_aliases): Ability to alias arguments

There are some cases where you need to have an argument to have an
alias, an example could be when you deprecate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:
```rust
Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")
```

Closes #669

Also you can alias flags as follow:
```rust
Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")
```
homu added a commit that referenced this pull request Oct 4, 2016
feat(arg_aliases): Ability to alias arguments

There are some cases where you need to have an argument to have an
alias, an example could be when you deprecate one option in favor of
another one.

Now you are going to be able to alias arguments as follows:
```rust
Arg::with_name("opt")
    .long("opt")
    .short("o")
    .takes_value(true)
    .alias("invisible")
    .visible_alias("visible")
```

Closes #669

Also you can alias flags as follow:
```rust
Arg::with_name("flg")
    .long("flag")
    .short("f")
    .alias("not_visible_flag")
    .visible_alias("awesome_v_flag")
```
@homu
Copy link
Contributor

homu commented Oct 4, 2016

⌛ Testing commit 905d3b9 with merge 4e7466c...

@homu
Copy link
Contributor

homu commented Oct 4, 2016

☀️ Test successful - status

@homu homu merged commit 905d3b9 into clap-rs:master Oct 4, 2016
@afiune
Copy link
Contributor Author

afiune commented Oct 4, 2016

@kbknapp Thank you for approving this!! 😄 I have one last question, when/how is the release process to be able to use this code? Anything I can do to help?

Thanks again!! 🎉

@kbknapp
Copy link
Member

kbknapp commented Oct 4, 2016

@afiune I'll be releasing the new version to crates.io tonight when I get home. 😉

@afiune afiune deleted the afiune/arg-aliases branch October 4, 2016 19:04
chef-delivery pushed a commit to chef-boneyard/delivery-cli that referenced this pull request Oct 14, 2016
We have contribute to the community with the PR
clap-rs/clap#674 and now we are able to alias
arguments natively.

Same functionality no improvements.

Signed-off-by: Salim Afiune <afiune@chef.io>
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.

6 participants