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

Use clap::ArgEnum to auto-generate possible cli arguments from Rust enums #10369

Closed

Commits on Feb 17, 2022

  1. Use clap-generated possible values in ConfigFormat

    Use the derive feature of clap to stop relying on hardcoded
    vector of strings and programmatically derive config values
    from the enum type
    petr-tik committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    30bd2d8 View commit details
    Browse the repository at this point in the history
  2. Replace static list of strings with clap::ArgEnum

    Stop returning static &str and use the clap-required
    possible_values trait method
    petr-tik committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    ec80cda View commit details
    Browse the repository at this point in the history
  3. Use a Result-returning clap method to prevent

    early bailing and messing up return code
    petr-tik committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    672dcde View commit details
    Browse the repository at this point in the history
  4. Prevent typos and the need for tests

    delegate &str creation to the to_possible_value()
    method provided by clap::ArgEnum. Since both arguments
    are non-skipped, we can safely use expect()
    petr-tik committed Feb 17, 2022
    Configuration menu
    Copy the full SHA
    5b1a975 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    8879d98 View commit details
    Browse the repository at this point in the history