aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Étienne Deparis 2020-11-01 18:03:10 +0100
committerGravatar Étienne Deparis 2020-11-01 18:03:10 +0100
commit7ef4198797aae888c9b8523e4b9974968c81b1c5 (patch)
tree68b99b8c87399e16a2d7bffd55a56abf9cd7f4f5
parentf17102b344f34381f2e3195a4feb3f1c691b80b7 (diff)
downloadshell_utils-7ef4198797aae888c9b8523e4b9974968c81b1c5.tar.gz
shell_utils-7ef4198797aae888c9b8523e4b9974968c81b1c5.tar.xz
shell_utils-7ef4198797aae888c9b8523e4b9974968c81b1c5.zip
feat(git-hist.rb): Add a new option to display commiter date
-rw-r--r--git-hist.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-hist.rb b/git-hist.rb
index 74a3b31..d367ca7 100644
--- a/git-hist.rb
+++ b/git-hist.rb
@@ -8,7 +8,7 @@ unless GitUtils.in_git_repository?
exit 1
end
-options = { last: 5, author: '%ae',
+options = { last: 5, author: '%ae', date: '%ad',
color: GitUtils.config('color.ui') }
OptionParser.new do |parser|
@@ -33,6 +33,11 @@ OptionParser.new do |parser|
options[:author] = '%an'
end
+ parser.on('-c', '--commiter-date', 'Display commiter date instead ' \
+ 'of author date') do
+ options[:date] = '%cd'
+ end
+
parser.on('--color [WHEN]', 'Show colored diff.') do |w|
options[:color] = w || 'auto'
end
@@ -42,7 +47,7 @@ OptionParser.new do |parser|
end
end.parse!
-pformat = "tformat:%h – %Cblue%ad%Creset| %C(cyan bold)%s%C(nobold)%C(yellow)%d%Creset [%C(magenta)#{options[:author]}%Creset]"
+pformat = "tformat:%h – %Cblue#{options[:date]}%Creset| %C(cyan bold)%s%C(nobold)%C(yellow)%d%Creset [%C(magenta)#{options[:author]}%Creset]"
unless %w[auto always never].include?(options[:color])
options[:color] = 'auto'