fix: use 'column', with 'vl', and 'sed' as fallbacks
This commit is contained in:
parent
9cfa616e87
commit
2db0a0ec91
1 changed files with 11 additions and 1 deletions
12
bin/g
12
bin/g
|
|
@ -29,6 +29,16 @@ confirmYes () {
|
||||||
esac
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
|
columnify () {
|
||||||
|
if which column > /dev/null; then
|
||||||
|
column -ts'|'
|
||||||
|
elif which vl > /dev/null; then
|
||||||
|
vl -s'\|'
|
||||||
|
else
|
||||||
|
sed 's/|/\t/g'
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
case "$1" in
|
case "$1" in
|
||||||
'?' | status)
|
'?' | status)
|
||||||
# TODO: Display help if not inside a repo
|
# TODO: Display help if not inside a repo
|
||||||
|
|
@ -296,7 +306,7 @@ done < "$TEMP/merged.branches"
|
||||||
git for-each-ref --sort=-committerdate refs/remotes \
|
git for-each-ref --sort=-committerdate refs/remotes \
|
||||||
--format='%(HEAD) %(color:green)%(committerdate:relative)%(color:reset)|%(color:red)%(objectname:short)%(color:reset)|%(color:blue)%(refname:short)%(color:reset)' > "$TEMP/remote.branches"
|
--format='%(HEAD) %(color:green)%(committerdate:relative)%(color:reset)|%(color:red)%(objectname:short)%(color:reset)|%(color:blue)%(refname:short)%(color:reset)' > "$TEMP/remote.branches"
|
||||||
# Print them in columns
|
# Print them in columns
|
||||||
cat "$TEMP/local.branches" "$TEMP/remote.branches" | vl -s'\|'
|
cat "$TEMP/local.branches" "$TEMP/remote.branches" | columnify
|
||||||
;;
|
;;
|
||||||
|
|
||||||
fetch)
|
fetch)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue