From 03b0e493a70307210a9e091977f078e5cbfcb504 Mon Sep 17 00:00:00 2001 From: Martin Schut Date: Sun, 19 Apr 2026 23:09:23 +0200 Subject: [PATCH] Harmonize POSIX shells into a single invocation --- install.sh | 25 +++++++++++-------------- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/install.sh b/install.sh index 90873a9..db7f88a 100755 --- a/install.sh +++ b/install.sh @@ -24,30 +24,27 @@ if [ -z "${HOME:-}" ]; then HOME="$(cd ~ && pwd)" fi +# Start the validation and installation +id="## git-pad" + case "$shell_name" in - bash) - rc="$HOME/.bashrc" - block=' -## git-pad -PATH=$PATH:'"$PWD"' -export PATH -. '"$PWD"'/autocompletion.bash' - ;; - zsh) - rc="$HOME/.zshrc" + bash | zsh) + rc="$HOME/.${shell_name}rc" + block=' -## git-pad +'"$id"' PATH=$PATH:'"$PWD"' export PATH -. '"$PWD"'/autocompletion.zsh' +. '"$PWD"'/autocompletion.'"$shell_name" ;; + *) echo "Unsupported shell: $shell_name"; exit 1 ;; esac -if grep -q '## git-pad' "$rc" 2>/dev/null; then +if grep -q "$id" "$rc" 2>/dev/null; then echo '!W: Looks like it is already installed' echo '--------------------------------------' - grep -C 5 '## git-pad' "$rc" + grep -C 5 "$id" "$rc" else echo "$block" >> "$rc" && echo "Installed successfully. Restart your shell." fi -- 2.54.0