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

Add support for shell completion #611

Merged
merged 5 commits into from
Dec 18, 2022
Merged

Add support for shell completion #611

merged 5 commits into from
Dec 18, 2022

Conversation

Freed-Wu
Copy link
Contributor

@Freed-Wu Freed-Wu commented Dec 8, 2022

Fixes #608.

If you install keyring by pip install 'keyring[completion]', you can
generate shell completions by:

keyring --print-completion bash | sudo tee /usr/share/bash-completion/compleitons/keyring
keyring --print-completion zsh | sudo tee /usr/share/zsh/site-functions/_keyring
keyring --print-completion tcsh | sudo tee /etc/profile.d/keyring.csh

Note: the path of /usr/share is only for GNU/Linux mostly. If you use other OSs,
try:

  • macOS, GUN/Linux (Homebrew): /usr/local/share
  • Android (Termux): /data/data/com.termux/files/usr/share
  • Windows (mingw64 of msys2): /mingw64/share
  • ...

If you install keyring by your package manager (apt, pacman, nix, homebrew, etc),
these shell completions should have been packaged and you don't need generate
them by yourself.

After install shell completions, you can enable shell completions by:

  • bash: install bash-completion, and
    . /usr/share/bash-completion/bash_completion in your bashrc.

  • zsh: autoload -Uz compinit && compinit in your zshrc, and
    grep -w keyring ~/.zcompdump to check if it is installed correctly:

    $ grep -w keyring ~/.zcompdump
    'keyring' '_keyring'

@jaraco jaraco changed the title Fix #608 Add support for shell completion Dec 18, 2022
jaraco added a commit that referenced this pull request Dec 18, 2022
@jaraco
Copy link
Owner

jaraco commented Dec 18, 2022

Releasing as 23.13.

@jaraco jaraco merged commit 1d76158 into jaraco:main Dec 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature] Shell completions
2 participants