Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we add completely install command to install completions? #18

Closed
DannyBen opened this issue May 19, 2022 · 0 comments · Fixed by #45
Closed

Should we add completely install command to install completions? #18

DannyBen opened this issue May 19, 2022 · 0 comments · Fixed by #45
Labels
enhancement New feature or request

Comments

@DannyBen
Copy link
Owner

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
@DannyBen DannyBen added the enhancement New feature or request label May 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant