From 6bf71a03099a489e71acc27e60b918087f6a6ab4 Mon Sep 17 00:00:00 2001 From: Luke Hsiao Date: Fri, 28 Oct 2022 18:58:58 -0700 Subject: [PATCH] refactor: improve help text for revision-range, default to HEAD Just took the text help from `man git-shortlog` on ``, since that is exactly where it is being called. --- README.md | 10 ++++++---- src/main.rs | 8 +++++++- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a6c892f..ab72a83 100644 --- a/README.md +++ b/README.md @@ -27,15 +27,17 @@ cargo install git-stats --locked ## Usage ``` -Usage: git-stats [OPTIONS] +$ git stats -h +A script for grabbing more thorough shortlog stats + +Usage: git-stats [OPTIONS] [revision-range] Arguments: - The revision range to consider + [revision-range] Show only commits in the specified revision range [default: HEAD] Options: -v, --verbose... More output per occurrence -q, --quiet... Less output per occurrence - -h, --help Print help information + -h, --help Print help information (use `--help` for more detail) -V, --version Print version information - ``` diff --git a/src/main.rs b/src/main.rs index b30833b..246df2f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,7 +11,13 @@ use xshell::{cmd, Shell}; #[derive(Parser)] #[command(author, version, about, long_about = None)] struct Cli { - /// The revision range to consider + #[arg(name = "revision-range", default_value = "HEAD")] + /// Show only commits in the specified revision range. + /// + /// When no is specified, it defaults to HEAD (i.e. the whole history leading + /// to the current commit). origin..HEAD specifies all the commits reachable from the current + /// commit (i.e. HEAD), but not from origin. For a complete list of ways to spell + /// [revision-range], see the "Specifying Ranges" section of gitrevisions(7). rev_range: String, #[command(flatten)] verbose: Verbosity,