From cd2e41bc17f861ff5702920457667a7777261b1d Mon Sep 17 00:00:00 2001 From: Maxim Likhachev Date: Thu, 10 Mar 2022 12:13:45 +0300 Subject: [PATCH] git-aliases: fix filter --- scripts/git-aliases | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/git-aliases b/scripts/git-aliases index 3b3115e..c8f7475 100755 --- a/scripts/git-aliases +++ b/scripts/git-aliases @@ -1,7 +1,7 @@ #!/usr/bin/env bash #Создан: чт 14 ноя 2019 14:03:43 -#Изменён: Пн 15 ноя 2021 10:31:17 +#Изменён: Чт 10 мар 2022 12:11:59 # Список псевдонимов git @@ -23,17 +23,17 @@ rstc="\033[00m" GITCONFIG=~/.gitconfig -GIT_ALIASES=$(git config --get-regexp 'alias.*' | sed 's/alias.//' | sed 's/ .*//' | sort) +GIT_ALIASES=$(git config --get-regexp 'alias.*' | grep alias | sed 's/alias.//' | sed 's/ .*//' | sort) while read -r alias; do - line=$(\grep -n -E "^\s*${alias}\s+" "$GITCONFIG") + line=$(\grep -n -E "^\s*${alias}\s+=" "$GITCONFIG") number=${line/:*} full_alias=${line/*:} - name=$(sed "s/^[[:space:]]*//; s/=.*$//g; ${number}q;d" $GITCONFIG) + name=$(sed -- "s/^[[:space:]]*//; s/=.*$//g; ${number}q;d" $GITCONFIG) - commentary=$(sed "s/[[:space:]]*# //; $((--number))q;d" $GITCONFIG) + commentary=$(sed -- "s/[[:space:]]*# //; $((--number))q;d" $GITCONFIG) if [[ ! "$full_alias" =~ "noindex" ]] && [[ ! "$commentary" =~ "noindex" ]]; then printf " • ${green}%-15s${rstc}- %s\n" "$name" "$commentary"