Skip to content

Commit f76b8cc

Browse files
authored
Merge pull request #489 from africanzoe/master
Fix: replace the old bash completion with a new one
2 parents b01b62c + 1a28f4a commit f76b8cc

File tree

3 files changed

+801
-1238
lines changed

3 files changed

+801
-1238
lines changed

contrib/completion/bash/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Bash completion of Scaleway command-line
2+
3+
This script helps you use `scw` command-line easily by generating a bash completion everytime you hit the `tab` key.
4+
5+
## How it works
6+
7+
- Simply copy the script named `scw.bash` to `/etc/bash_completion.d` it will be sourced everytime you login or you simulate a login.
8+
- You can also put it in your `HOMEDIR` and source it with your login shell option by adding the following line in your `~/.bash_profile`:
9+
```
10+
source ~/.scw.bash
11+
```
12+
13+
## Tuning variables
14+
15+
For more flexibility the behaviour of the completion if controlled by the following vars:
16+
17+
- **GET_SCW_SRVS**: it could be an env variable in your shell set by the command `export GET_SCW_SRVS="yes"`. If this option is enabled the completion will call Scaleway API to fetch for your managed servers and displays them. It default to "no" because fetching servers names takes around 1s which is quite long for command-line completion.
18+
- **GET_SCW_IMGS**: it could be an env variable in your shell set by the command `export GET_SCW_IMGS="yes"`. If this option is enabled the completion will call Scaleway API to fetch for the available images and displays them. It default to "no" because fetching images takes around 1s which is quite long for command-line completion.
19+
- **nospace**: this is a built-in shell completion option when set to `-o nospace` allows you to remove the space add to word when the completion happens.
20+
21+
## TODO
22+
23+
- Tune every function completion for more parsing options by tracking all the sub-options and handle them.

0 commit comments

Comments
 (0)