Open ajeetdsouza opened 1 year ago
clap can't look this information up directly. CARGO_PKG_REPOSITORY
and CARGO_PKG_HOMEPAGE
would need to be looked up within your code and passed in. Even with the derive API, we prefer to at least opt-in for inferred fields to be passed in (#[command(name)]
). We'd need to add a Command::homepage
or something for users / the derive to pass this in that would only exist for the sake of the help template which to me is questionable value for the cost that everyone would be paying.
However, we are (slowly) working on a plugin system to clap. The easiest example is that clap should know nothing about ValueHint
but instead it should be in clap_complete
but we allow users to attach state like that to an Arg
without caring what it is. So a user could set clap_complete::ValueHint
and clap_complete
can read it when needed.
We could have help-template specific plugins that would make it so only the people using them would be paying the cost for them.
Please complete the following tasks
Clap Version
4.3.2
Describe your use case
It would be great if I could add the application homepage URL to the help page via a template key, eg.:
An example -
ripgrep
uses the following format for the start of the help page:Describe the solution you'd like
A key for
{homepage}
and{repository}
would fix this.Alternatives, if applicable
No response
Additional Context
I want to use the repository variable in zoxide's help page, so that users can report issues more easily.