Skip to content

Migrate examples from docopt to structopt. #528

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

Merged
merged 1 commit into from
Mar 17, 2020

Conversation

ratmice
Copy link
Contributor

@ratmice ratmice commented Mar 14, 2020

Looking at the examples, I noticed that according to the docopt README, "This crate is unlikely to see significant future evolution.", as well as "Consider using clap or possibly structopt instead."

It didn't seem like it'd be difficult to do, so I figured i might as well go ahead and cold-call it.
However this has only undegone light testing.

Notes:

  • log.rs: had to reorder struct members to get the multiple varargs working.
  • various: --foo --bar I'd tried using a name="n" long="foo", this worked, unless there were 2 things wanting to be named n. So I partially backed that, but only in the places where e.g. occurred multiple times.
  • all: rather than rename struct members from flag_... and arg_... naming convention, I used the name = "...", this lead to a much cleaner patch. I could do a search/replace over s/flag_// and remove the corresponding name="..." in a follow up if this patch is wanted and that is preferred.

@ratmice ratmice force-pushed the examples-structopt branch from 9f47101 to c497651 Compare March 14, 2020 06:13
@ratmice ratmice force-pushed the examples-structopt branch from c497651 to ad80304 Compare March 14, 2020 08:50
@alexcrichton alexcrichton merged commit e4ebe77 into rust-lang:master Mar 17, 2020
@ratmice ratmice deleted the examples-structopt branch March 17, 2020 14:15
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