completely
completely copied to clipboard
Should we add `completely install` command to install completions?
We can port this logic from bash:
# Figure out if we need sudo or not
sudo=''
if [[ $EUID -ne 0 ]]; then
sudo='sudo'
fi
# Install completions
if [[ -d "/usr/share/bash-completion/completions" ]]; then
compdir="/usr/share/bash-completion/completions"
elif [[ -d "/usr/local/etc/bash_completion.d" ]]; then
compdir="/usr/local/etc/bash_completion.d"
else
compdir=''
fi
if [[ -n $compdir ]]; then
echo "=== Installing autocompletions to $compdir"
echo "eval \"\$(rush completions)\"" | $sudo tee "${compdir}/rush" > /dev/null
else
echo "=== Completion script was not installed"
echo " To install it manually add this to your startup script:"
echo " eval \"\$(rush completions)\""
fi