mirror of
https://github.com/tj/git-extras.git
synced 2026-09-10 23:46:24 -04:00
Merge pull request #633 from nschlimm/columnsflex
Columns in git-effort adopt to file length
This commit is contained in:
commit
b0ba3e5346
|
|
@ -104,7 +104,7 @@ effort() {
|
|||
len=${#path}
|
||||
dot="."
|
||||
f_dot="$path"
|
||||
i=0 ; while test $i -lt $((45-$len)) ; do
|
||||
i=0 ; while test $i -lt $(( $columns - $len )) ; do
|
||||
f_dot=$f_dot$dot
|
||||
i=$(($i+1))
|
||||
done
|
||||
|
|
@ -124,7 +124,7 @@ effort() {
|
|||
|
||||
heading() {
|
||||
echo
|
||||
printf " %-45s %-10s %s\n" 'path' 'commits' 'active days'
|
||||
printf " %-${columns}s %-10s %s\n" 'path' 'commits' 'active days'
|
||||
echo
|
||||
}
|
||||
|
||||
|
|
@ -177,6 +177,10 @@ fi
|
|||
args_to_git_log="${args_to_git_log#\ \'\'}"
|
||||
export args_to_git_log
|
||||
|
||||
# set column width to match longest filename
|
||||
columns=$(( $(git ls-files | awk '{ print length }' | sort -rn | head -1 ) + 5 ))
|
||||
export columns
|
||||
|
||||
# [path ...]
|
||||
|
||||
if test "${#paths}" -eq 0; then
|
||||
|
|
|
|||
Loading…
Reference in a new issue