Skip to content

Commit

Permalink
bug: install script must source .bashrc to check for bash_completion …
Browse files Browse the repository at this point in the history
…installation
  • Loading branch information
closedLoop committed Jul 22, 2024
1 parent 90168c9 commit 149c4ce
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
22 changes: 10 additions & 12 deletions autocomplete.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
# Do not use `set -euo pipefail` or similar because this a
# bash completion script and it will change the behavior of the shell invoking it

export ACSH_VERSION=0.3.3
export ACSH_VERSION=0.3.4

###############################################################################
#
Expand Down Expand Up @@ -937,21 +937,19 @@ Please follow the install instructions on https://github.com/closedloop-technolo
echo "Added autocomplete cli autocomplete to $bashrc_file"
fi

# $(model_command)

echo_green "Autocomplete.sh - LLM Powered Bash Completion - Version $ACSH_VERSION - https://autocomplete.sh"
echo -e "\e[1;34mInstall Completed\e[0m"
echo
echo -e "Please run \e[1;34msource $bashrc_file\e[0m to enable autocomplete"
echo_green "Autocomplete.sh - LLM Powered Bash Completion - Version $ACSH_VERSION"
echo -e "\e[1;34mInstall Completed\e[0m"
echo
echo "Then:"
echo -e "$ \e[1;34mautocomplete model\e[0m \tto select the language model"

echo "Two more commands to run steps to complete the installation:"
echo -e "1. $ \e[1;34msource $bashrc_file\e[0m to enable autocomplete"
echo -e "2. $ \e[1;34mautocomplete model\e[0m \tto select the language model"
echo
echo -e "$ \e[1;30mautocomplete config\e[0m \tto view settings"
echo -e "$ \e[1;30mautocomplete --help\e[0m \tto enable autocomplete"


echo -e "$ \e[1;30mautocomplete --help\e[0m \tfor additional commands"
echo
echo -e "Visit \e[1;32mhttps://autocomplete.sh\e[0m for examples and more information"
echo
}

remove_command() {
Expand Down
19 changes: 14 additions & 5 deletions docs/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# This install script downloads the latest version of the LLMs

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

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

# Check if the _init_completion function exists
# Source bash-completion if _init_completion function does not exist
if ! type -t _init_completion &> /dev/null; then
echo "ERROR: Please ensure you have bash-completion installed and sourced."
else
"$INSTALL_LOCATION" install
# shellcheck disable=SC1091
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
else
echo "ERROR: Please ensure you have bash-completion installed and sourced."
exit 1
fi
fi

# Proceed with installation
"$INSTALL_LOCATION" install

0 comments on commit 149c4ce

Please sign in to comment.