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

Non-hardcoded configuration - use configure_me? #44

Open
Kixunil opened this issue Feb 28, 2022 · 0 comments
Open

Non-hardcoded configuration - use configure_me? #44

Kixunil opened this issue Feb 28, 2022 · 0 comments

Comments

@Kixunil
Copy link

Kixunil commented Feb 28, 2022

Hardcoding configuration makes it annoying to debug things. I suggest to use my crate configure_me to do that and offer making a full PR as well as adding required features (subcommand support) to the library. The primary advantage of configure_me is support of config files and dirs out of the box. configure_me is used in electrs among other projects.

structopt vs configure_me

Common properties

  • Declarative syntax
  • Parse and validate Rust types - no manual conversion
  • Correct support of non-uf8 paths (Path{Buf}, OsStr{ing}); I think structopt requires enabling this explicitly?
  • Generate help page
  • Environment variable support

Advantages of configure_me

  • Support of config files and dirs with ability to override things and include files from arguments
  • Generate man pages
  • Explicitly correct GNU-style params/switches (--key val, --key=val, -xyzkval...; maybe structopt is still good enough?)
  • Toml file enables processing by external tools
  • MSRV will always support the Rust version available in Debian stable

Advantages of structopt

  • Not using Toml makes it work with IDEs and the struct is more obvious
  • Generate shell completions
  • Mature and popular
  • Native subcommand support (this should be irrelevant here since I'm willing to add support)

Disclaimer: I may be missing some things, feel free to point out/ask.

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