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

Replace gumdrop with clap v3 (beta 1) #330

Closed
wants to merge 2 commits into from

Conversation

andynog
Copy link

@andynog andynog commented Aug 4, 2020

closes: #298

I've started the work to try to replace gumdrop with clap v3.

  • Mostly replace dependencies in Cargo.toml files. Replaced gumdrop (0.7) with clap (3.0.0-beta.1)
  • Replaced attributes that used gumdrop #[option(... with #[clap... since clap supports this with clap_derive
  • Replaced some gumdrop Error with clap Error

After replacing these, got stuck on core/src/command/entrypoint.rs where the compilation is failing because changes in the file. Especially the command property of this struct. Couldn't find an equivalent way to replace it with clap. Tried to use the #[clap(subcommand)] attribute on this property but it seems make the compiler not to recognize the Cmd type

error[E0412]: cannot find type `Cmd` in this scope
  --> core/src/command/entrypoint.rs:33:25
   |
33 |     pub command: Option<Cmd>,
   |                         ^^^ not found in this scope

So I believe this is a good starting point but I believe some more fundamental changes will be required in order to replace gumdrop with clap. Especially things related to help and usage which clap supports. So maybe things that currently exist in abscissa like core/src/command -> entrypoint, help and usage might not need to exist or be refactored quite a bit.

Another challenge is that clap also has a concept of App but it's more related to command line arguments and the executable, so it might differ from Abscissa's CliApplication that can track the State.

Anyways, I think we can use this draft PR to have discussions on what is the best way to proceed and I'd be happy to help out with this effort.

@tony-iqlusion tony-iqlusion self-requested a review August 4, 2020 21:45
@tony-iqlusion
Copy link
Member

The best way to get started might be to get rid of EntryPoint entirely. It seems like it may be unnecessary at this point.

@andynog
Copy link
Author

andynog commented Aug 4, 2020

The best way to get started might be to get rid of EntryPoint entirely. It seems like it may be unnecessary at this point.

Ok, thanks. I will look into how it can be eliminated.

@PRTGC
Copy link

PRTGC commented Sep 9, 2020

Subcommands and help for them would be awesome...
I've been trying to implement it, without much success...

An example when done, would be stellar...
JR

@tony-iqlusion
Copy link
Member

Note this auto-closed when I renamed the default branch from develop to main. It's not for lack of interest.

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.

Replace gumdrop with clap v3?
4 participants