Skip to content

Commit 149c4ce

Browse files
committed
bug: install script must source .bashrc to check for bash_completion installation
1 parent 90168c9 commit 149c4ce

File tree

2 files changed

+24
-17
lines changed

2 files changed

+24
-17
lines changed

autocomplete.sh

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# Do not use `set -euo pipefail` or similar because this a
1010
# bash completion script and it will change the behavior of the shell invoking it
1111

12-
export ACSH_VERSION=0.3.3
12+
export ACSH_VERSION=0.3.4
1313

1414
###############################################################################
1515
#
@@ -937,21 +937,19 @@ Please follow the install instructions on https://github.com/closedloop-technolo
937937
echo "Added autocomplete cli autocomplete to $bashrc_file"
938938
fi
939939

940-
# $(model_command)
941-
942-
echo_green "Autocomplete.sh - LLM Powered Bash Completion - Version $ACSH_VERSION - https://autocomplete.sh"
943-
echo -e "\e[1;34mInstall Completed\e[0m"
944940
echo
945-
echo -e "Please run \e[1;34msource $bashrc_file\e[0m to enable autocomplete"
941+
echo_green "Autocomplete.sh - LLM Powered Bash Completion - Version $ACSH_VERSION"
942+
echo -e "\e[1;34mInstall Completed\e[0m"
946943
echo
947-
echo "Then:"
948-
echo -e "$ \e[1;34mautocomplete model\e[0m \tto select the language model"
949-
944+
echo "Two more commands to run steps to complete the installation:"
945+
echo -e "1. $ \e[1;34msource $bashrc_file\e[0m to enable autocomplete"
946+
echo -e "2. $ \e[1;34mautocomplete model\e[0m \tto select the language model"
950947
echo
951948
echo -e "$ \e[1;30mautocomplete config\e[0m \tto view settings"
952-
echo -e "$ \e[1;30mautocomplete --help\e[0m \tto enable autocomplete"
953-
954-
949+
echo -e "$ \e[1;30mautocomplete --help\e[0m \tfor additional commands"
950+
echo
951+
echo -e "Visit \e[1;32mhttps://autocomplete.sh\e[0m for examples and more information"
952+
echo
955953
}
956954

957955
remove_command() {

docs/install.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# This install script downloads the latest version of the LLMs
55

66
# The URL of the latest version of the LLMs
7-
ACSH_VERSION="0.3.3"
7+
ACSH_VERSION="0.3.4"
88
URL="https://raw.githubusercontent.com/closedloop-technologies/autocomplete-sh/v${ACSH_VERSION}/autocomplete.sh"
99

1010
# The default location to install the LLMs
@@ -29,9 +29,18 @@ if ! command -v jq &> /dev/null; then
2929
echo "For macOS (using Homebrew): brew install jq"
3030
fi
3131

32-
# Check if the _init_completion function exists
32+
# Source bash-completion if _init_completion function does not exist
3333
if ! type -t _init_completion &> /dev/null; then
34-
echo "ERROR: Please ensure you have bash-completion installed and sourced."
35-
else
36-
"$INSTALL_LOCATION" install
34+
# shellcheck disable=SC1091
35+
if [ -f /usr/share/bash-completion/bash_completion ]; then
36+
. /usr/share/bash-completion/bash_completion
37+
elif [ -f /etc/bash_completion ]; then
38+
. /etc/bash_completion
39+
else
40+
echo "ERROR: Please ensure you have bash-completion installed and sourced."
41+
exit 1
42+
fi
3743
fi
44+
45+
# Proceed with installation
46+
"$INSTALL_LOCATION" install

0 commit comments

Comments
 (0)