Skip to content

Fix shell completion installation instructions for Linux #124

Description

@robzolkos

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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions