diff options
author | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-27 16:31:04 +0100 |
---|---|---|
committer | Eric Engestrom <eric.engestrom@intel.com> | 2018-07-30 15:56:15 +0100 |
commit | 27e89cf61dab7b92edd905a50df3429d51c65e79 (patch) | |
tree | 175ff53a8de2f3a0201eb8da953b16ec1fc9f10a /completions/bash | |
parent | Merge pull request #2384 from 1ace/fix/zsh-completion (diff) | |
download | sway-27e89cf61dab7b92edd905a50df3429d51c65e79.tar.gz sway-27e89cf61dab7b92edd905a50df3429d51c65e79.tar.zst sway-27e89cf61dab7b92edd905a50df3429d51c65e79.zip |
bash: add completion for sway
Diffstat (limited to 'completions/bash')
-rw-r--r-- | completions/bash/sway | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/completions/bash/sway b/completions/bash/sway new file mode 100644 index 00000000..edd752cd --- /dev/null +++ b/completions/bash/sway | |||
@@ -0,0 +1,46 @@ | |||
1 | # sway(1) completion | ||
2 | |||
3 | _sway() | ||
4 | { | ||
5 | local cur prev | ||
6 | _get_comp_words_by_ref cur prev | ||
7 | |||
8 | short=( | ||
9 | -h | ||
10 | -c | ||
11 | -C | ||
12 | -d | ||
13 | -v | ||
14 | -V | ||
15 | ) | ||
16 | |||
17 | long=( | ||
18 | --help | ||
19 | --config | ||
20 | --validate | ||
21 | --debug | ||
22 | --version | ||
23 | --verbose | ||
24 | --get-socketpath | ||
25 | ) | ||
26 | |||
27 | case $prev in | ||
28 | -c|--config) | ||
29 | _filedir | ||
30 | return | ||
31 | ;; | ||
32 | esac | ||
33 | |||
34 | if [[ $cur == --* ]]; then | ||
35 | COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) | ||
36 | elif [[ $cur == -* ]]; then | ||
37 | COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) | ||
38 | COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) | ||
39 | else | ||
40 | COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) | ||
41 | COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) | ||
42 | COMPREPLY+=($(compgen -c -- "$cur")) | ||
43 | fi | ||
44 | |||
45 | } && | ||
46 | complete -F _sway sway | ||