Replaced -g and -A with -F gpg|authordate

This commit is contained in:
Tobias Fendin 2022-06-26 12:49:43 +02:00
parent 233b3f0dd4
commit bf240df083
4 changed files with 43 additions and 38 deletions

View file

@ -5,7 +5,7 @@
usage() {
cat <<EOS
Usage:
git standup [-a <author name>] [-w <weekstart-weekend>|-d <days-ago>] [-m <max-dir-depth>] [-D date-format] [-A] [-g] [-L] [-h] [-f] [-B] [-n <number-of-commits]
git standup [-a <author name>] [-w <weekstart-weekend>|-d <days-ago>] [-m <max-dir-depth>] [-D date-format] [-L] [-h] [-f] [-B] [-n <number-of-commits] [-F <gpg|authordate>]
-a - Specify author to restrict search to, default to current git user.
Use "-a all" if you don't want the restriction.
@ -14,12 +14,12 @@ usage() {
-L - Toggle inclusion of symbolic links in recursive directory search
-d - Specify the number of days back to include
-D - Specify the date format for "git log" (default: relative)
-A - Print author date instead of commit date
-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
@ -66,8 +66,9 @@ set -e
RANGE_SPECIFIED=
COMMIT_DATE_FORMAT=%cd
USE_GPG_FORMAT=no
while getopts "hgfBd:a:w:m:D:An:L" opt; do
while getopts "hgfF:Bd:a:w:m:D:n:L" opt; do
case $opt in
h)
usage
@ -80,9 +81,6 @@ while getopts "hgfBd:a:w:m:D:An:L" opt; do
AUTHOR="$OPTARG"
fi
;;
A)
COMMIT_DATE_FORMAT=%ad
;;
d)
test -n "$RANGE_SPECIFIED" && warn "-d option is conflict with -w"
RANGE_SPECIFIED=yes
@ -129,7 +127,8 @@ while getopts "hgfBd:a:w:m:D:An: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
@ -137,6 +136,21 @@ while getopts "hgfBd:a:w:m:D:An: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
@ -160,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(${COMMIT_DATE_FORMAT}) %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)

View file

@ -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" "May 2022" "" "Git Extras"
.TH "GIT\-STANDUP" "1" "June 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] [\-A] [\-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"
@ -34,18 +34,10 @@ Limit the search range to weekdays\. If \fIweekstart\fR and/or \fIweekend\fR are
.P
The date format displayed in commit history\. Defaults to "relative"\.
.P
\-A
.P
Print the author date instead of the commit date\.
.P
\-h
.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\.
@ -59,6 +51,10 @@ 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\. \fB\-F gpg\fR: Display if commit is GPG signed (G) or not (N)\. \fB\-F authordate\fR: Print the author date instead of the commit date\.
.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

View file

@ -78,7 +78,7 @@
</p>
<h2 id="SYNOPSIS">SYNOPSIS</h2>
<p><code>git-standup</code> [-a author] [-w <var>weekstart-weekend</var>|-d <var>days-ago</var>] [-m depth] [-D date format] [-A] [-g] [-L] [-f] [-B] [-n number of commits]<br>
<p><code>git-standup</code> [-a author] [-w <var>weekstart-weekend</var>|-d <var>days-ago</var>] [-m depth] [-D date format] [-L] [-f] [-B] [-n number of commits] [-F <var>gpg|authordate</var>]<br>
<code>git-standup</code> -h</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@ -115,18 +115,10 @@ I.e. calling <code>git standup -w -</code> on a Monday will include commits made
<p>The date format displayed in commit history. Defaults to "relative".</p>
<p>-A</p>
<p>Print the author date instead of the commit date.</p>
<p>-h</p>
<p>Display help message.</p>
<p>-g</p>
<p>Display if commit is GPG signed (G) or not (N) in commit message.</p>
<p>-f</p>
<p>Fetch the latest commits before showing commit history.</p>
@ -148,6 +140,10 @@ When <code>-B</code> is specific, the limitation is applied in the branch level
if each of your 3 repositories have 2 branches, <code>git standup ... -B -n 1</code> will
display 6 commits at most.</p>
<p>-F <var>gpg|authordate</var></p>
<p>Change how the commits are formatted. Takes an argument, can be specified multiple times. <code>-F gpg</code>: Display if commit is GPG signed (G) or not (N). <code>-F authordate</code>: Print the author date instead of the commit date.</p>
<h2 id="GIT-CONFIGS">GIT CONFIGS</h2>
<p>You can configure a implicit -w <var>weekstart-weekend</var>, which is superseded if -w or -d is given on the command line.
@ -218,7 +214,7 @@ master
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>May 2022</li>
<li class='tc'>June 2022</li>
<li class='tr'>git-standup(1)</li>
</ol>

View file

@ -3,7 +3,7 @@ git-standup(1) -- Recall the commit history
## SYNOPSIS
`git-standup` [-a author] [-w <weekstart-weekend>|-d <days-ago>] [-m depth] [-D date format] [-A] [-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
@ -40,18 +40,10 @@ I.e. calling `git standup -w -` on a Monday will include commits made on the las
The date format displayed in commit history. Defaults to "relative".
-A
Print the author date instead of the commit date.
-h
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.
@ -73,6 +65,10 @@ 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 <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.