From b1208f9db543b93c29d3d63098a2a39f2b0c00f0 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jul 2024 12:01:21 -0300 Subject: [PATCH 1/3] fix: sometimes the completion directories already exist --- cli/cli.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index 6b971ade..fa2d2d9b 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -81,7 +81,7 @@ EXAMPLE: case "bash": fmt.Println(fmt.Sprintf(` # run the following commands to install auto-completion -sudo mkdir /etc/bash_completion.d/ +sudo mkdir -p /etc/bash_completion.d/ sudo cp %s /etc/bash_completion.d/abra echo "source /etc/bash_completion.d/abra" >> ~/.bashrc # To test, run the following: "abra app " - you should see command completion! @@ -89,7 +89,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc case "zsh": fmt.Println(fmt.Sprintf(` # run the following commands to install auto-completion -sudo mkdir /etc/zsh/completion.d/ +sudo mkdir -p /etc/zsh/completion.d/ sudo cp %s /etc/zsh/completion.d/abra echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc # to test, run the following: "abra app " - you should see command completion! -- 2.47.2 From e99114e695c96a120956a6eeb1ff5030f483a32e Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jul 2024 12:02:22 -0300 Subject: [PATCH 2/3] fix: setup should be run once --- cli/cli.go | 6 +++--- scripts/installer/installer | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/cli/cli.go b/cli/cli.go index fa2d2d9b..8377c3fc 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -80,7 +80,7 @@ EXAMPLE: switch shellType { case "bash": fmt.Println(fmt.Sprintf(` -# run the following commands to install auto-completion +# run the following commands once to install auto-completion sudo mkdir -p /etc/bash_completion.d/ sudo cp %s /etc/bash_completion.d/abra echo "source /etc/bash_completion.d/abra" >> ~/.bashrc @@ -88,7 +88,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc `, autocompletionFile)) case "zsh": fmt.Println(fmt.Sprintf(` -# run the following commands to install auto-completion +# run the following commands to once install auto-completion sudo mkdir -p /etc/zsh/completion.d/ sudo cp %s /etc/zsh/completion.d/abra echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc @@ -96,7 +96,7 @@ echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra `, autocompletionFile)) case "fish": fmt.Println(fmt.Sprintf(` -# run the following commands to install auto-completion +# run the following commands once to install auto-completion sudo mkdir -p /etc/fish/completions sudo cp %s /etc/fish/completions/abra echo "source /etc/fish/completions/abra" >> ~/.config/fish/config.fish diff --git a/scripts/installer/installer b/scripts/installer/installer index b6e0e543..781fd5e9 100755 --- a/scripts/installer/installer +++ b/scripts/installer/installer @@ -87,7 +87,7 @@ function install_abra_release { x=$(echo $PATH | grep $HOME/.local/bin) if [ $? -ne 0 ]; then - echo "$(tput setaf 3)WARNING: $HOME/.local/bin/ is not in \$PATH! If you want to run abra by just typing "abra" you should add it to your \$PATH! To do that run:$(tput sgr0)" + echo "$(tput setaf 3)WARNING: $HOME/.local/bin/ is not in \$PATH! If you want to run abra by just typing "abra" you should add it to your \$PATH! To do that run this once and restart your terminal:$(tput sgr0)" p=$HOME/.local/bin com="echo PATH=\$PATH:$p" if [[ $SHELL =~ "bash" ]]; then -- 2.47.2 From 7f0a74d3c30dc1ef3d255d0141111b7fd9a7c299 Mon Sep 17 00:00:00 2001 From: f Date: Thu, 11 Jul 2024 12:02:38 -0300 Subject: [PATCH 3/3] fix: source autocompletion on the current terminal --- cli/cli.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cli/cli.go b/cli/cli.go index 8377c3fc..cea0b9ef 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -84,6 +84,7 @@ EXAMPLE: sudo mkdir -p /etc/bash_completion.d/ sudo cp %s /etc/bash_completion.d/abra echo "source /etc/bash_completion.d/abra" >> ~/.bashrc +source /etc/bash_completion.d/abra # To test, run the following: "abra app " - you should see command completion! `, autocompletionFile)) case "zsh": @@ -92,6 +93,7 @@ echo "source /etc/bash_completion.d/abra" >> ~/.bashrc sudo mkdir -p /etc/zsh/completion.d/ sudo cp %s /etc/zsh/completion.d/abra echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra" >> ~/.zshrc +source /etc/zsh/completion.d/abra # to test, run the following: "abra app " - you should see command completion! `, autocompletionFile)) case "fish": @@ -100,6 +102,7 @@ echo "PROG=abra\n_CLI_ZSH_AUTOCOMPLETE_HACK=1\nsource /etc/zsh/completion.d/abra sudo mkdir -p /etc/fish/completions sudo cp %s /etc/fish/completions/abra echo "source /etc/fish/completions/abra" >> ~/.config/fish/config.fish +source /etc/fish/completions/abra # to test, run the following: "abra app " - you should see command completion! `, autocompletionFile)) } -- 2.47.2