-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Show the type of arguments in help message? #5156
Comments
|
My thought
So this would look like
|
By making it optional both of these issues are solved, no? |
In clap, we have to balance features with compile time, binary size, and API size. Adding the suggested solution for a niche would hurt the whole. If you are set on it being implemented that way, you can extend your doc comments to include the type information. |
We talked about this some in the WG-CLI meeting We'd like to keep configuration down to a minimum due to compile time + binary size concerns. This means we'd likely not want to make placerholder vs literal configurable. In that case, we leaned towards literals (when a meaningful enough one can be made). If we default to literals, then working around it with |
Current proposal Add: trait TypedValueParser {
// ... existing
/// Fallback for [`Arg::value_name`] for options
fn get_value_name(&self) -> Option<String> {
None
}
/// Fallback for [`Arg::value_name`] for options
fn value_parser(self, name: fn() -> String) -> NamedValueParser {
NamedValueParser { name, self }
}
}
pub NamedValueParser {
name: fn() -> String,
inner: impl TypedValueParser
}
// ....
let value_names = if let Some(value_names) = arg.get_value_names() {
value_names
} else if arg.is_positional() {
[arg.get_id()]
} else {
self.get_value_parser().get_value_names()
}; Hmm, the main problem with this is this mostly helps |
Just realized that a way to force showing of the literal would be to respect hide_possible_values. This would help cases like #5203. |
Discussed in #5153
Originally posted by tigerros October 1, 2023
Let's say you have this:
Running
--help
will show this message:Is it possible to also show the type? For example:
u32
would be nice, but it's not standard.The text was updated successfully, but these errors were encountered: