Browse Source

git-aliases: fix filter

master
Maxim Likhachev 3 years ago
parent
commit
cd2e41bc17
  1. 10
      scripts/git-aliases

10
scripts/git-aliases

@ -1,7 +1,7 @@ @@ -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" @@ -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"

Loading…
Cancel
Save