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

Migrate away from gumdrop for argument parsing #437

Closed
str4d opened this issue Jan 7, 2024 · 3 comments
Closed

Migrate away from gumdrop for argument parsing #437

str4d opened this issue Jan 7, 2024 · 3 comments
Milestone

Comments

@str4d
Copy link
Owner

str4d commented Jan 7, 2024

The last gumdrop release was almost two years ago, and its developer has marked their status on GitHub as "On indefinite hiatus from all programming work". In particular, this means that gumdrop is stuck on syn 1 (and it is one of only two dependencies stuck there). So I'm looking to migrate away from gumdrop to another crate.

My initial feeling is that I'll migrate to clap, for a few reasons:

  • clap is actively maintained.
  • Back when I chose gumdrop over clap, the latter was much heavier with many dependencies. This has apparently improved in recent releases.
  • I use clap to generate the shell completion files, so I already have a clap representation of the CLIs.

However, I do want to take this opportunity to examine what other alternatives exist, and what would work best for rage:

  • Argument handling must support the same semantics that rage relies on for its flags.
  • I don't mind the text UI changing a bit (wrt how flags are displayed in help text etc), but it should have a similar UX (if not better).
  • Integration with my localization stack (fluent and i18n-embed) would be really nice. Currently I adjust the help text to have localized explanatory text and examples, but the help text for the actual flags is un-localizable.
  • I'm not too concerned about binary size or compile times, but they ideally won't regress too far.
@str4d
Copy link
Owner Author

str4d commented Jan 7, 2024

Potentially useful comparision data: https://github.com/rosetta-rs/argparse-rosetta-rs

@str4d
Copy link
Owner Author

str4d commented Jan 7, 2024

Reading clap-rs/clap#380 it sounds like although there is no built-in support yet, clap does have sufficient APIs to enable localization, and other people have tested doing so with Fluent. Combined with the fact that I already have a clap representation of the CLIs, I think I'll put effort into that direction and see how far I get.

@str4d str4d mentioned this issue Jan 8, 2024
@str4d
Copy link
Owner Author

str4d commented Jan 8, 2024

#442 migrates to clap, which made it pretty easy (once I figured out the kinks) to localize the usage and help text. I didn't end up using any of the existing builder-based clap representation, as migrating from gumdrop to clap's derive-based representation ended up being simpler. I still need to figure out how to migrate the completions etc. away from my current approach to de-duplicate, but if that works then this is almost certainly what I'll merge.

@str4d str4d added this to the rage 0.10.0 milestone Jan 8, 2024
@str4d str4d closed this as completed in f9087be Jan 10, 2024
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

No branches or pull requests

1 participant