MacOS
On MacOS you need to install homebrew and then use brew to install bash-completion and then add bash completion to your shell. You might also have to upgrade bash as MacOS ships with a fairly old version and this affects bash-completion scripts.
First, install homebrew from https://brew.sh/ You probably already have this if you installed jotta-cli on MacOS.
Second, check your bash version:
echo $BASH_VERSION
If your bash major version is less than 4 you need to upgrade:
brew install bash
Now you need to whitelist the new bash version by adding it to the list of shells found in the file /etc/shells
After whitelisting the shell ensure you are running the new version by running
chsh -s /usr/local/bin/bash
More information on upgrading bash is available here: https://itnext.io/upgrading-bash-on-macos-7138bd1066ba?gi=a0e70050c3ff
Third, install bash-completion:
brew install bash-completion
and remember to follow the instructions about how to add bash-completion to your shell typically something like below:
Add the following line to your ~/.bash_profile:
[[ -r "/usr/local/etc/profile.d/bash_completion.sh" ]] && . "/usr/local/etc/profile.d/bash_completion.sh"
Fourth, add the following to your ~/.bash_profile
:
. <(jotta-cli completion)
Linux
Many linux distros come with bash-completion already loaded. If not you can run
apt-get install bash-completion
or the non-debian equivalent.
Then, add the following to your ~/.bash_profile
or ~/.bashrc
. <(jotta-cli completion)