Better usage message in help output#1906
Conversation
Improve the usage message to better indicate that the path is optional, but must come after a pattern.
| after_long_help = "Bugs can be reported on GitHub: https://github.com/sharkdp/fd/issues", | ||
| max_term_width = 98, | ||
| args_override_self = true, | ||
| override_usage = "fd [OPTIONS] [pattern [path]...]", |
There was a problem hiding this comment.
My one concern here, is that if the command is fdfind instead, the help output will still say fd.
I'm not really sure how to get around that though.
There was a problem hiding this comment.
You could just grab std::env::args()[0]
There was a problem hiding this comment.
Hmm, I'm not sure if that would work in the macro, but could probably be done with the api
There was a problem hiding this comment.
ok 1ea3719 does that. But it has a different issue where if you invoke it with something like target/debug/fd it will use the full path instead of just fd. I'm not sure which is worse. I could maybe try and figure out just the basename, but that makes this more complicated.
There was a problem hiding this comment.
and that makes tests more complicated 😕
|
Google's documentation style guide for CLIS states
and it is non-standard for how several command line parsing libraries, including clap output option help, so I'm not really sure this is the best change anyway. In fact, I kind of wonder if it would have been better to just have the base path(s) be specified as an option rather than as a positional argulment. probably too late for that now though. |
Improve the usage message to better indicate that the path is optional, but must come after a pattern.