Skip to content
This repository was archived by the owner on Feb 19, 2025. It is now read-only.

Commit 500b7e4

Browse files
author
Joshua Wehner
committed
Simplify git-graphlive (defaults to 10 commits)
1 parent 498ae58 commit 500b7e4

File tree

1 file changed

+9
-19
lines changed

1 file changed

+9
-19
lines changed

git-graphlive

+9-19
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
11
#!/bin/bash
2-
numRegex='[0-9]+$'
3-
usrLen=$1
4-
usrTime=$2
5-
defLen=15
6-
defTime=3
72

8-
# Command line argument processing
9-
if [[ $usrLen =~ $numRegex && $usrTime =~ $numRegex ]]; then
10-
# A valid number of lines and refresh rate were passed in
11-
else
12-
# Invalid or no lines and refresh rate were provided
13-
# so instead, using defaults instead.
14-
usrLen=$defLen
15-
usrTime=$defTime
3+
commits=$1
4+
#Defaults commits to 10
5+
if [ -z "$1" ];
6+
then
7+
commits=10
168
fi
179

18-
# Infinite loop for displaying a portion of the graph
19-
# at specified refresh intervals.
10+
2011
while :
2112
do
22-
clear
23-
git --no-pager log -$usrLen --graph --all --pretty=format:'%Cgreen%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative
24-
sleep $usrTime
13+
clear
14+
git --no-pager log -$commits --graph --all --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s' --abbrev-commit --date=relative
15+
sleep 2
2516
done
26-

0 commit comments

Comments
 (0)