Closed zleyyij closed 2 weeks ago
https://github.com/clap-rs/clap_derive/blob/master/examples/keyvalue.rs
This should be easy, just have a vec of key value pairs, iterate over all of them and set them as env vars on startup
Completed as of 2a2c7c39b25d0c7a96ba1d9abe89974f69bb2d24, you can now set config options by passing --cfg
/-c
, and a comma delimited list of settings, or multiple occurrences of the --cfg
/-c
flag.
Example:
hyde --cfg OPT_1=himom,OPT_2=hello
hyde -c OPT_1=himom -c OPT_2=hello
Clap should make this easier, I suppose you could have the process set its own environment variables from the CLI options if you still wanted everything as an environment variable, without a global config struct or something like that.