Skip to content

Commit 29bd4d2

Browse files
committed
chore(doc): add alternative way to source bash completions
1 parent 5bcc04a commit 29bd4d2

1 file changed

Lines changed: 18 additions & 3 deletions

File tree

README.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,16 @@ upctl -h
5858

5959
Setting up bash completion requires a few commands more.
6060

61+
First, install `bash-completion`, if it is not installed already.
62+
6163
```bash
62-
# If you have not installed bash-completion already
6364
brew install bash-completion
6465
echo '[ -f "$(brew --prefix)/etc/bash_completion" ] && . "$(brew --prefix)/etc/bash_completion"' >> ~/.bash_profile
66+
```
67+
68+
Then configure the shell completions for `upctl` by saving the output of `upctl completion bash` in `upctl` file under `/etc/bash_completion.d/`:
6569

70+
```bash
6671
upctl completion bash > $(brew --prefix)/etc/bash_completion.d/upctl
6772
. $(brew --prefix)/etc/bash_completion
6873
```
@@ -86,11 +91,21 @@ upctl -h
8691
```
8792

8893
Bash completion can also be set up with some extra commands. You should adapt this for your package manager.
94+
95+
First, install `bash-completion`, if it is not installed already.
96+
8997
```bash
90-
# If you have not installed bash-completion already
9198
sudo apt install bash-completion
92-
echo "[ -f /etc/bash_completion ] && . /etc/bash_completion" >> ~/.bash_profile
99+
echo "[ -f /etc/bash_completion ] && . /etc/bash_completion" >> ~/.bashrc
100+
```
101+
102+
Then configure the shell completions for `upctl` by either sourcing `upctl completion bash` output in your bash `.bashrc` or by saving the output of that command in `upctl` file under `/etc/bash_completion.d/`:
103+
104+
```bash
105+
# First alternative
106+
echo 'source <(upctl completion bash)' >>~/.bashrc
93107

108+
# Second alternative
94109
upctl completion bash | sudo tee /etc/bash_completion.d/upctl > /dev/null
95110
. /etc/bash_completion
96111
```

0 commit comments

Comments
 (0)