From a5f22fd72e94222a1e099f04c1a32dfa6ecf5296 Mon Sep 17 00:00:00 2001 From: xeruf <27jf@pm.me> Date: Fri, 9 Jul 2021 09:08:11 +0200 Subject: [PATCH] config/shell: improve wh highlighting --- .config/shell/functions | 4 ++-- .local/bin/scripts/git-get | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.config/shell/functions b/.config/shell/functions index fa1f3e4..f679258 100644 --- a/.config/shell/functions +++ b/.config/shell/functions @@ -50,9 +50,9 @@ rd() { wh() { res=$(which "$@") if expr "$res" : "${@:$#}: aliased to" >/dev/null - then echo "$res" && wh $(expr "$res" : "${@:$#}: aliased to ${@:$#} " >/dev/null && echo "-p") $(echo "$res" | cut -d' ' -f4) + then echo "$res" | bat --style=plain --language=sh && wh $(expr "$res" : "${@:$#}: aliased to ${@:$#} " >/dev/null && echo "-p") $(echo "$res" | cut -d' ' -f4) # use command which for other shells - else test -r "$res" && b --style=header "$res" || echo "$res" | bat --style=plain --language=sh + else test -r "$res" && b --style=header "$res" || echo "$res" | bat --style=plain --language=sh fi } compdef wh=which diff --git a/.local/bin/scripts/git-get b/.local/bin/scripts/git-get index 09adc5c..11565dd 100755 --- a/.local/bin/scripts/git-get +++ b/.local/bin/scripts/git-get @@ -1,6 +1,7 @@ #!/bin/sh # Clones from resolving the arguments and switches into the new directory +set -e remote=$(git-repo "$@") echo "Cloning $remote" -git clone $remote ${@:4} --recurse-submodules || return $? +git clone $remote ${@:4} --recurse-submodules cd "$(test $4 && echo $4 || basename ${remote%.git})"