#970 standup added -A flag for author date

This commit is contained in:
Tobias Fendin 2022-05-14 15:17:58 +02:00
parent fdf89cd93f
commit 233b3f0dd4
4 changed files with 27 additions and 10 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>] [-g] [-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] [-A] [-g] [-L] [-h] [-f] [-B] [-n <number-of-commits]
-a - Specify author to restrict search to, default to current git user.
Use "-a all" if you don't want the restriction.
@ -14,6 +14,7 @@ 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
@ -64,8 +65,9 @@ fi
set -e
RANGE_SPECIFIED=
COMMIT_DATE_FORMAT=%cd
while getopts "hgfBd:a:w:m:D:n:L" opt; do
while getopts "hgfBd:a:w:m:D:An:L" opt; do
case $opt in
h)
usage
@ -78,6 +80,9 @@ while getopts "hgfBd:a:w:m:D:n: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
@ -155,7 +160,7 @@ 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_PRETTY_FORMAT"
GIT_DATE_FORMAT=${GIT_DATE_FORMAT:=relative}
# Handle config of 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" "April 2022" "" "Git Extras"
.TH "GIT\-STANDUP" "1" "May 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] [\-A] [\-g] [\-L] [\-f] [\-B] [\-n number of commits]
.br
\fBgit\-standup\fR \-h
.SH "DESCRIPTION"
@ -28,12 +28,16 @@ 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
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\.

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] [-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] [-A] [-g] [-L] [-f] [-B] [-n number of commits]<br>
<code>git-standup</code> -h</p>
<h2 id="DESCRIPTION">DESCRIPTION</h2>
@ -108,13 +108,17 @@ Defaults to <code>$(git config user.name)</code>.</p>
<p>Limit the search range to weekdays.
If <var>weekstart</var> and/or <var>weekend</var> are missing they default to Mon and Fri.
If the current day is <var>weekstart</var> commits made on <var>weekend</var> will be included.
If the current day is <var>weekstart</var>, commits made on <var>weekend</var> will be included.
I.e. calling <code>git standup -w -</code> on a Monday will include commits made on the last Friday.</p>
<p>-D relative</p>
<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>
@ -214,7 +218,7 @@ master
<ol class='man-decor man-foot man foot'>
<li class='tl'></li>
<li class='tc'>April 2022</li>
<li class='tc'>May 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] [-g] [-L] [-f] [-B] [-n number of commits]
`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` -h
## DESCRIPTION
@ -40,6 +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.