Skip to content

Non-hardcoded configuration - use configure_me? #44

@Kixunil

Description

@Kixunil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions