You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Either we generate the env variables during _build (env will internally need to be a Cow), leaving help generation and env variable look up unchanged or we do it on lookup/display
(where a custom prefix could be set by #[clap(env_prefix="foo")], but the default was the #[clap(name)])
Alternatives, if applicable
I don't think there's an alternative solution to manually setting the environment variable for every option that needs it.
There was a suggestion in the above issue about allowing this to be calculated via a function vs a string literal, but I can't think of a good use-case for it, so it seems unnecessary for this feature.
Additional Context
Examples from the above issue:
rust-analyzer looks for RA_LOG var, rustc looks for RUSC_LOG var, sccache looks for SCCACHE_ENDPOINT, SCCACHE_CACHE_SIZE, SCCACHE_REDIS and other....
Maintainer's notes
Command::next_env_prefixandArg::env_prefixand is modeled afterhelp_headingCommand::next_env_prefixapplies to all futureArgs and is set during.arg()Arg::env_prefixtakes precedence overCommand::next_env_prefixCommand::next_env_prefixpart-way through struct definition_build(envwill internally need to be aCow), leaving help generation and env variable look up unchanged or we do it on lookup/displayPlease complete the following tasks
Clap Version
v3.0.0-rc.8
Describe your use case
This was previously discussed in TeXitoi/structopt#370.
Basically the request is to be able to allow a specific prefix to be appended to all
#[clap(env)]derived environment variable names.Describe the solution you'd like
Before:
After:
(where a custom prefix could be set by
#[clap(env_prefix="foo")], but the default was the#[clap(name)])Alternatives, if applicable
I don't think there's an alternative solution to manually setting the environment variable for every option that needs it.
There was a suggestion in the above issue about allowing this to be calculated via a function vs a string literal, but I can't think of a good use-case for it, so it seems unnecessary for this feature.
Additional Context
Examples from the above issue:
rust-analyzerlooks forRA_LOGvar,rustclooks forRUSC_LOGvar,sccachelooks forSCCACHE_ENDPOINT,SCCACHE_CACHE_SIZE,SCCACHE_REDISand other....