Skip to content

Commit

Permalink
fix(help): Prefer short version over long version
Browse files Browse the repository at this point in the history
When we got clap-rs#3193, we decided in clap-rs#3196 that `--help` will give a summary
for other commands (`subcmd --help` in this case) but not show the long
version of the output for that other command.

Now with clap-rs#3215, I think the case is similar for `--help` not showing the
long version but instead preferring the short version and encouraging
people to run `--version`.

Originally. clap only showed the short version or nothing.  This was
changed in clap-rs#2369 without fanfare to prefer the long version over short.
Now are we preferring short version over the long version always, just
like all other help.

Fixes clap-rs#3215
  • Loading branch information
epage committed Dec 30, 2021
1 parent 81c636c commit 889a70e
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions src/output/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,11 +634,7 @@ impl<'help, 'app, 'parser, 'writer> Help<'help, 'app, 'parser, 'writer> {
}

fn write_version(&mut self) -> io::Result<()> {
let version = if self.use_long {
self.parser.app.long_version.or(self.parser.app.version)
} else {
self.parser.app.version
};
let version = self.parser.app.version.or(self.parser.app.long_version);
if let Some(output) = version {
self.none(text_wrapper(output, self.term_w))?;
}
Expand Down

0 comments on commit 889a70e

Please sign in to comment.