Environment variable name aliases #5447
Labels
A-parsing
Area: Parser's logic and needs it changed somehow.
C-enhancement
Category: Raise on the bar on expectations
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Clap Version
4.4.8
Describe your use case
Clap already supports aliases for short and long argument names, which is superb, especially for keeping backward compatibility. Yet environment variables lack this feature that can be useful in all the same cases.
For example, if my CLI changes one of its arguments’ name, I can keep compatibility with
short_alias
andalias
functions and derive parameters. But if such an argument has an environment variable assigned, I either need to keep the name that became inconsistent with the argument name or introduce a breaking CLI change.For another case, the same will be true if I no longer need separate arguments for something that now can be treated as one value, so I need to merge two argument names. The
short_aliases
andaliases
will cover it great. But environment variables will hold me back from doing so.Describe the solution you'd like
It’d be nice to have the same alias options for environment variables, like
env_aliases
andenv_alias
—a super-similar implementation to what argument names have.Alternatives, if applicable
No response
Additional Context
I can prepare a PR if there are no objections, considerations, or pitfalls I’m missing. Maybe I overlooked something, or there are some limitations.
The text was updated successfully, but these errors were encountered: