bat
bat copied to clipboard
output shell completion script by `bat --completion <shell>` command
Currently the autocompletion script comes only with the source.
A better approach, would be something like bat --completion=bash
.
Here is my current bash_completion
script executed at login:
source <($HOME/.local/bin/helm completion bash)
source <($HOME/.local/bin/kustomize completion bash)
source <($HOME/.local/bin/pip completion --bash)
source <($HOME/.local/bin/stern --completion=bash)
source <($HOME/.local/node/bin/npm completion)
source $HOME/.local/bat/autocomplete/bat.bash # this can become `bat --completion=bash`
The bash completion should be placed in this ~/.local/share/bash-completion/completions
directory.
Q. Where should I install my own local completions?
A. Put them in the completions subdir of $BASH_COMPLETION_USER_DIR (defaults to $XDG_DATA_HOME/bash-completion or ~/.local/share/bash-completion if $XDG_DATA_HOME is not set) to have them loaded automatically on demand when the respective command is being completed. See also the next question's answer for considerations for these files' names, they apply here as well. Alternatively, you can write them directly in ~/.bash_completion which is loaded eagerly by our main script.
For system wide installation (e.g. packaging deb, ...) the completion may be placed in /etc/bash_completion.d/
.
@abuGit - I don't think you understand my feature request.
I am asking for a completion script built-in from bat completion
command directly.
Yes, bat completion
command does not exist - that's what I am asking for.
I would really like this, too, for zsh
. It's really convenient to be able to do {tool} completion --shell {zsh|bash|fish}
at install-time to also install/refresh shell completions.
I haven't figured out a good way to get the completions when installing bat
using cargo
. This issue would solve the problem imo.