(Website) Cannot generate completions for bash and zsh without sudo

Open Beginner friendly
#673 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
68/100
Issue type
Documentation
Clarity
Mostly clear
Activity status
Quiet
Tech stack
bash, zsh
Domain
cli, documentation

Research direction

Open the website page at usage.jdx.dev/cli/completions and locate the bash and zsh installation instructions shown in the issue. Update the commands so privileged writes use sudo with tee, then check that both examples are accurate and no longer rely on shell redirection into protected directories.

Written by the indexing model from the issue text.

Description

On the website the instructions for generating completions for bash and zsh are given as:

usage --completions bash > /etc/bash_completion.d/usage
usage --completions zsh > /usr/share/zsh/site-functions/_usage

The problem is redirection to those directories requires root access so both commands would fail. Here is the improved version using 'tee' with 'sudo':

usage --completions bash | sudo tee /etc/bash_completion.d/usage
usage --completions zsh | sudo tee /usr/share/zsh/site-functions/_usage

If echoing the content of completions to stdout is undesirable, it can be hidden:

usage --completions bash | sudo tee /etc/bash_completion.d/usage >/dev/null
usage --completions zsh | sudo tee /usr/share/zsh/site-functions/_usage >/dev/null
Dominant language
Rust
Stars
1k
Forks
59
Avg merge
5h 58m
Merged PRs (30d)
362

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from jdx/usage

All issues in jdx/usage

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.