The current completion instructions fail on Linux for bash and zsh because they write to system directories without proper root access.
Problem
Shell redirection (>) is executed by the current shell, not by sudo, so these fail with Permission denied:
Bash
$ bcq completion bash > /etc/bash_completion.d/bcq <-- fails
Zsh (when fpath[1] is a system directory)
$ bcq completion zsh > "${fpath[1]}/_bcq"
Proposed fix
Follow GitHub CLI's approach - recommend user-local methods as primary:
Bash:
To load completions for every new session, add to ~/.bashrc:
eval "$(bcq completion bash)"
Or install system-wide (requires root):
$ bcq completion bash | sudo tee /etc/bash_completion.d/bcq > /dev/null
Zsh:
To load completions for every new session, add to ~/.zshrc:
eval "$(bcq completion zsh)"
Or install to a user directory in your fpath:
$ mkdir -p ~/.zsh/completions
$ bcq completion zsh > ~/.zsh/completions/_bcq
# Then add to ~/.zshrc: fpath=(~/.zsh/completions $fpath)
The current completion instructions fail on Linux for bash and zsh because they write to system directories without proper root access.
Problem
Shell redirection (>) is executed by the current shell, not by sudo, so these fail with Permission denied:
Bash
$ bcq completion bash > /etc/bash_completion.d/bcq <-- fails
Zsh (when fpath[1] is a system directory)
$ bcq completion zsh > "${fpath[1]}/_bcq"
Proposed fix
Follow GitHub CLI's approach - recommend user-local methods as primary:
Bash:
To load completions for every new session, add to ~/.bashrc:
eval "$(bcq completion bash)"
Or install system-wide (requires root):
$ bcq completion bash | sudo tee /etc/bash_completion.d/bcq > /dev/null
Zsh:
To load completions for every new session, add to ~/.zshrc:
eval "$(bcq completion zsh)"
Or install to a user directory in your fpath: