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

Switch to Clap #207

Closed
killercup opened this issue Mar 16, 2018 · 5 comments · Fixed by #295
Closed

Switch to Clap #207

killercup opened this issue Mar 16, 2018 · 5 comments · Fixed by #295

Comments

@killercup
Copy link
Owner

cargo itself recently switched to clap. I know we've had an issue open before about switching away from doctopt and closed it because we wanted to be able to integrate cargo-edit into cargo at some point. Guess we can actually get rid of docopt in good conscience now!

@kbknapp
Copy link

kbknapp commented Mar 20, 2018

I've got this basically implemented, just need to convert the final few tests.

It's essentially a 1:1 port where the only difference is clap enforcing some of the constraints instead of cargo-edit.

The only user facing difference is when using --upgrade=minor it always uses the prefix ^ instead of "". I kind of prefer the explicitness of this, but if you'd prefer to keep "" as the minor prefix it's a simple change.

@killercup
Copy link
Owner Author

@kbknapp awesome! I'm fine with having the explicit ^. @bjgill, @ordian, what do you think?

@ordian
Copy link
Collaborator

ordian commented Mar 20, 2018

I don't have a strong opinion on that, but would prefer having ^ only if user specifies --upgrade=minor explicitly.

@kbknapp
Copy link

kbknapp commented Mar 23, 2018

Yeah I should have worded that better, but it sounds like you both picked up on my meaning despite my poor choice of words 😜

For others reading this:

Currently in cargo-edit using nothing for the upgrade method (which defaults to minor) uses a blank prefix of "" (empty string) because to cargo it has the same meaning as explicitly using the ^ prefix. Such as 1.2.3 being equivalent to ^1.2.3. However, if the user specified --upgrade=minor on the command line, it used the explicit ^ prefix.

In the port to clap I used the explicit prefix in both cases, when the user uses --upgrade=minor on the command line and when they use nothing and just lets the default case work.

@DCjanus
Copy link
Contributor

DCjanus commented May 22, 2019

Is that ok if I’d like to replace docopt with structopt, rather than clap?

Obviously, structopt has a better API, but I'm not sure if this will hinder the plan that being part of cargo in the future. structopt::StructOpt can be easily converted to clap::APP.

bors bot added a commit that referenced this issue May 27, 2019
295: Migrate 'docopt' to 'structopt' r=ordian a=DCjanus

Close #207

Co-authored-by: DCjanus <dcjanus@dcjanus.com>
@bors bors bot closed this as completed in #295 May 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants