mirror of
https://github.com/iridakos/goto.git
synced 2025-05-16 07:20:17 -07:00
Set the maximum length of a shortcut as left column width
This commit is contained in:
parent
43b592b88f
commit
7d77bc328d
9
goto.sh
9
goto.sh
@ -128,8 +128,15 @@ _goto_list_aliases()
|
|||||||
{
|
{
|
||||||
local IFS=$' '
|
local IFS=$' '
|
||||||
if [ -f "$GOTO_DB" ]; then
|
if [ -f "$GOTO_DB" ]; then
|
||||||
|
local maxlength=0
|
||||||
while read -r name directory; do
|
while read -r name directory; do
|
||||||
printf '\e[1;36m%20s \e[0m%s\n' "$name" "$directory"
|
local length=${#name}
|
||||||
|
if [[ $length -gt $maxlength ]]; then
|
||||||
|
local maxlength=$length
|
||||||
|
fi
|
||||||
|
done < "$GOTO_DB"
|
||||||
|
while read -r name directory; do
|
||||||
|
printf "\e[1;36m%${maxlength}s \e[0m%s\n" "$name" "$directory"
|
||||||
done < "$GOTO_DB"
|
done < "$GOTO_DB"
|
||||||
else
|
else
|
||||||
echo "You haven't configured any directory aliases yet."
|
echo "You haven't configured any directory aliases yet."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user