diff --git a/bin/git-standup b/bin/git-standup index d2f0ad4..5a3213e 100755 --- a/bin/git-standup +++ b/bin/git-standup @@ -5,7 +5,7 @@ usage() { cat <] [-w |-d ] [-m ] [-g] [-h] [-f] [-B] [-n ] [-w |-d ] [-m ] [-D date-format] [-L] [-h] [-f] [-B] [-n ] -a - Specify author to restrict search to, default to current git user. Use "-a all" if you don't want the restriction. @@ -15,10 +15,11 @@ usage() { -d - Specify the number of days back to include -D - Specify the date format for "git log" (default: relative) -h - Display this help screen - -g - Show if commit is GPG signed (G) or not (N) -f - Fetch the latest commits beforehand -B - Display the commits in branch groups -n - Limit the number of commits displayed per group + -F gpg - Show if commit is GPG signed (G) or not (N) + -F authordate - Print author date instead of commit date Examples: git standup -a "John Doe" -w "MON-FRI" -m 3 @@ -64,8 +65,10 @@ fi set -e RANGE_SPECIFIED= +COMMIT_DATE_FORMAT=%cd +USE_GPG_FORMAT=no -while getopts "hgfBd:a:w:m:D:n:L" opt; do +while getopts "hgfF:Bd:a:w:m:D:n:L" opt; do case $opt in h) usage @@ -124,7 +127,8 @@ while getopts "hgfBd:a:w:m:D:n:L" opt; do GIT_DATE_FORMAT=${OPTARG} ;; g) - GIT_PRETTY_FORMAT="%C(yellow)gpg: %G?%Creset" + warn "-g option is deprecated, use '-F gpg' instead" + USE_GPG_FORMAT=yes ;; B) GROUP_BY_BRANCHES=true @@ -132,6 +136,21 @@ while getopts "hgfBd:a:w:m:D:n:L" opt; do n) MAX_COMMIT_NUM=${OPTARG} ;; + F) + case $OPTARG in + gpg) + USE_GPG_FORMAT=yes + ;; + authordate) + COMMIT_DATE_FORMAT=%ad + ;; + *) + warn "Invalid argument for -F: $OPTARG" + usage + exit 1 + ;; + esac + ;; \?) usage exit 1 @@ -155,8 +174,11 @@ fi AUTHOR=${AUTHOR:="$(git config user.name)"} FETCH_LAST_COMMIT=${FETCH_LAST_COMMIT:=false} MAXDEPTH=${MAXDEPTH:=2} -GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(%cd) %C(bold blue)<%an>%Creset $GIT_PRETTY_FORMAT" +GIT_PRETTY_FORMAT="%Cred%h%Creset - %s %Cgreen(${COMMIT_DATE_FORMAT}) %C(bold blue)<%an>%Creset" GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative} +if [[ "$USE_GPG_FORMAT" == 'yes' ]]; then + GIT_PRETTY_FORMAT="$GIT_PRETTY_FORMAT %C(yellow)gpg: %G?%Creset" +fi # Handle config of implicit week IMPLICIT_WEEK=$(git config --get git-extras.standup.implicit-week) diff --git a/man/git-standup.1 b/man/git-standup.1 index 5078a8c..f6f35e2 100644 --- a/man/git-standup.1 +++ b/man/git-standup.1 @@ -1,10 +1,10 @@ .\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "GIT\-STANDUP" "1" "April 2022" "" "Git Extras" +.TH "GIT\-STANDUP" "1" "July 2022" "" "Git Extras" .SH "NAME" \fBgit\-standup\fR \- Recall the commit history .SH "SYNOPSIS" -\fBgit\-standup\fR [\-a author] [\-w \fIweekstart\-weekend\fR|\-d \fIdays\-ago\fR] [\-m depth] [\-D date format] [\-g] [\-L] [\-f] [\-B] [\-n number of commits] +\fBgit\-standup\fR [\-a author] [\-w \fIweekstart\-weekend\fR|\-d \fIdays\-ago\fR] [\-m depth] [\-D date format] [\-L] [\-f] [\-B] [\-n number of commits] [\-F \fIgpg|authordate\fR] .br \fBgit\-standup\fR \-h .SH "DESCRIPTION" @@ -28,7 +28,7 @@ The start of commit history\. Defaults to 1, means "1 days ago"\. .P \-w \fIweekstart\-weekend\fR .P -Limit the search range to weekdays\. If \fIweekstart\fR and/or \fIweekend\fR are missing they default to Mon and Fri\. If the current day is \fIweekstart\fR commits made on \fIweekend\fR will be included\. I\.e\. calling \fBgit standup \-w \-\fR on a Monday will include commits made on the last Friday\. +Limit the search range to weekdays\. If \fIweekstart\fR and/or \fIweekend\fR are missing they default to Mon and Fri\. If the current day is \fIweekstart\fR, commits made on \fIweekend\fR will be included\. I\.e\. calling \fBgit standup \-w \-\fR on a Monday will include commits made on the last Friday\. .P \-D relative .P @@ -38,10 +38,6 @@ The date format displayed in commit history\. Defaults to "relative"\. .P Display help message\. .P -\-g -.P -Display if commit is GPG signed (G) or not (N) in commit message\. -.P \-f .P Fetch the latest commits before showing commit history\. @@ -55,6 +51,15 @@ Display the commits in branch groups\. \-n number\-of\-commits .P Limit the number of commits displayed per group\. By default, the limitation is applied in the repository level\. For example, if you have 3 repositories under the current directory, \fBgit standup \|\.\|\.\|\. \-n 1\fR will show you 3 commits at most\. When \fB\-B\fR is specific, the limitation is applied in the branch level\. For instance, if each of your 3 repositories have 2 branches, \fBgit standup \|\.\|\.\|\. \-B \-n 1\fR will display 6 commits at most\. +.P +\-F \fIgpg|authordate\fR +.P +Change how the commits are formatted\. Takes an argument, can be specified multiple times\. +.IP "\[ci]" 4 +\fB\-F gpg\fR: Display if commit is GPG signed (G) or not (N)\. +.IP "\[ci]" 4 +\fB\-F authordate\fR: Print the author date instead of the commit date\. +.IP "" 0 .SH "GIT CONFIGS" You can configure a implicit \-w \fIweekstart\-weekend\fR, which is superseded if \-w or \-d is given on the command line\. Note that the \fIweekstart\-weekend\fR must be specified, they don\'t have any default values as the \fB\-w\fR flag has\. .IP "" 4 diff --git a/man/git-standup.html b/man/git-standup.html index 50b0a36..3b8413d 100644 --- a/man/git-standup.html +++ b/man/git-standup.html @@ -78,7 +78,7 @@

SYNOPSIS

-

git-standup [-a author] [-w weekstart-weekend|-d days-ago] [-m depth] [-D date format] [-g] [-L] [-f] [-B] [-n number of commits]
+

git-standup [-a author] [-w weekstart-weekend|-d days-ago] [-m depth] [-D date format] [-L] [-f] [-B] [-n number of commits] [-F gpg|authordate]
git-standup -h

DESCRIPTION

@@ -108,7 +108,7 @@ Defaults to $(git config user.name).

Limit the search range to weekdays. If weekstart and/or weekend are missing they default to Mon and Fri. -If the current day is weekstart commits made on weekend will be included. +If the current day is weekstart, commits made on weekend will be included. I.e. calling git standup -w - on a Monday will include commits made on the last Friday.

-D relative

@@ -119,10 +119,6 @@ I.e. calling git standup -w - on a Monday will include commits made

Display help message.

-

-g

- -

Display if commit is GPG signed (G) or not (N) in commit message.

-

-f

Fetch the latest commits before showing commit history.

@@ -144,6 +140,17 @@ When -B is specific, the limitation is applied in the branch level if each of your 3 repositories have 2 branches, git standup ... -B -n 1 will display 6 commits at most.

+

-F gpg|authordate

+ +

Change how the commits are formatted. Takes an argument, can be specified multiple times.

+ +
    +
  • +-F gpg: Display if commit is GPG signed (G) or not (N).
  • +
  • +-F authordate: Print the author date instead of the commit date.
  • +
+

GIT CONFIGS

You can configure a implicit -w weekstart-weekend, which is superseded if -w or -d is given on the command line. @@ -214,7 +221,7 @@ master

  1. -
  2. April 2022
  3. +
  4. July 2022
  5. git-standup(1)
diff --git a/man/git-standup.md b/man/git-standup.md index 5956b50..49f6de5 100644 --- a/man/git-standup.md +++ b/man/git-standup.md @@ -3,7 +3,7 @@ git-standup(1) -- Recall the commit history ## SYNOPSIS -`git-standup` [-a author] [-w |-d ] [-m depth] [-D date format] [-g] [-L] [-f] [-B] [-n number of commits] +`git-standup` [-a author] [-w |-d ] [-m depth] [-D date format] [-L] [-f] [-B] [-n number of commits] [-F ] `git-standup` -h ## DESCRIPTION @@ -44,10 +44,6 @@ The date format displayed in commit history. Defaults to "relative". Display help message. --g - -Display if commit is GPG signed (G) or not (N) in commit message. - -f Fetch the latest commits before showing commit history. @@ -69,6 +65,13 @@ When `-B` is specific, the limitation is applied in the branch level. For insta if each of your 3 repositories have 2 branches, `git standup ... -B -n 1` will display 6 commits at most. +-F + +Change how the commits are formatted. Takes an argument, can be specified multiple times. + +* `-F gpg`: Display if commit is GPG signed (G) or not (N). +* `-F authordate`: Print the author date instead of the commit date. + ## GIT CONFIGS You can configure a implicit -w , which is superseded if -w or -d is given on the command line.