mirror of
https://github.com/iridakos/goto.git
synced 2024-05-11 05:55:16 +00:00
Merge pull request #63 from f1rstlady/width-aware-list
Set the maximum length of the shortcuts as left column width
This commit is contained in:
@@ -128,8 +128,15 @@ _goto_list_aliases()
|
||||
{
|
||||
local IFS=$' '
|
||||
if [ -f "$GOTO_DB" ]; then
|
||||
local maxlength=0
|
||||
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"
|
||||
else
|
||||
echo "You haven't configured any directory aliases yet."
|
||||
|
||||
Reference in New Issue
Block a user