jdx / jdx/usage

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

Open
#673 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
1k
Forks
59
Avg merge
5h 58m
Merged PRs (30d)
362

Description

On the [website](https://usage.jdx.dev/cli/completions) the instructions for generating completions for bash and zsh are given as:
```bash
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':
```bash
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:
```bash
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
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.