diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-07-30 13:11:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-30 13:11:20 -0400 |
commit | 878d1ddd07b5ce452d3d7e1606f20f8560f2f11b (patch) | |
tree | 742714aeaff5118afabf0cb2179040655510e9df /completions | |
parent | Merge pull request #2381 from frsfnrrg/key-repeat (diff) | |
parent | meson: install bash completion (diff) | |
download | sway-878d1ddd07b5ce452d3d7e1606f20f8560f2f11b.tar.gz sway-878d1ddd07b5ce452d3d7e1606f20f8560f2f11b.tar.zst sway-878d1ddd07b5ce452d3d7e1606f20f8560f2f11b.zip |
Merge pull request #2387 from 1ace/feature/bash-completion
bash completion
Diffstat (limited to 'completions')
-rw-r--r-- | completions/bash/sway | 46 | ||||
-rw-r--r-- | completions/bash/swayidle | 48 | ||||
-rw-r--r-- | completions/bash/swaylock | 66 | ||||
-rw-r--r-- | completions/bash/swaymsg | 57 |
4 files changed, 217 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 | ||
diff --git a/completions/bash/swayidle b/completions/bash/swayidle new file mode 100644 index 00000000..a0cdc8b2 --- /dev/null +++ b/completions/bash/swayidle | |||
@@ -0,0 +1,48 @@ | |||
1 | # swaymsg(1) completion | ||
2 | |||
3 | _swayidle() | ||
4 | { | ||
5 | local cur prev | ||
6 | _get_comp_words_by_ref -n : cur prev | ||
7 | local prev2=${COMP_WORDS[COMP_CWORD-2]} | ||
8 | local prev3=${COMP_WORDS[COMP_CWORD-3]} | ||
9 | |||
10 | events=( | ||
11 | 'timeout' | ||
12 | 'before-sleep' | ||
13 | ) | ||
14 | |||
15 | short=( | ||
16 | -h | ||
17 | -d | ||
18 | ) | ||
19 | |||
20 | if [ "$prev" = timeout ]; then | ||
21 | # timeout <timeout> | ||
22 | return | ||
23 | elif [ "$prev2" = timeout ]; then | ||
24 | # timeout <timeout> <timeout command> | ||
25 | COMPREPLY=($(compgen -c -- "$cur")) | ||
26 | return | ||
27 | elif [ "$prev3" = timeout ]; then | ||
28 | # timeout <timeout> <timeout command> [resume <resume command>] | ||
29 | COMPREPLY=(resume) | ||
30 | # optional argument; no return here as user may skip 'resume' | ||
31 | fi | ||
32 | |||
33 | case "$prev" in | ||
34 | resume) | ||
35 | COMPREPLY=($(compgen -c -- "$cur")) | ||
36 | return | ||
37 | ;; | ||
38 | before-sleep) | ||
39 | COMPREPLY=($(compgen -c -- "$cur")) | ||
40 | return | ||
41 | ;; | ||
42 | esac | ||
43 | |||
44 | COMPREPLY+=($(compgen -W "${events[*]}" -- "$cur")) | ||
45 | COMPREPLY+=($(compgen -W "${short[*]}" -- "$cur")) | ||
46 | |||
47 | } && | ||
48 | complete -F _swayidle swayidle | ||
diff --git a/completions/bash/swaylock b/completions/bash/swaylock new file mode 100644 index 00000000..33925480 --- /dev/null +++ b/completions/bash/swaylock | |||
@@ -0,0 +1,66 @@ | |||
1 | # swaylock(1) completion | ||
2 | |||
3 | _swaylock() | ||
4 | { | ||
5 | local cur prev | ||
6 | _get_comp_words_by_ref -n : cur prev | ||
7 | |||
8 | short=( | ||
9 | -h | ||
10 | -c | ||
11 | -s | ||
12 | -t | ||
13 | -v | ||
14 | -i | ||
15 | -u | ||
16 | -f | ||
17 | ) | ||
18 | |||
19 | long=( | ||
20 | --help | ||
21 | --color | ||
22 | --scaling | ||
23 | --tiling | ||
24 | --version | ||
25 | --image | ||
26 | --no-unlock-indicator | ||
27 | --daemonize | ||
28 | ) | ||
29 | |||
30 | scaling=( | ||
31 | 'stretch' | ||
32 | 'fill' | ||
33 | 'fit' | ||
34 | 'center' | ||
35 | 'tile' | ||
36 | ) | ||
37 | |||
38 | case $prev in | ||
39 | -c|--color) | ||
40 | return | ||
41 | ;; | ||
42 | --scaling) | ||
43 | COMPREPLY=($(compgen -W "${scaling[*]}" -- "$cur")) | ||
44 | return | ||
45 | ;; | ||
46 | -i|--image) | ||
47 | if grep -q : <<< "$cur"; then | ||
48 | output="${cur%%:*}:" | ||
49 | cur="${cur#*:}" | ||
50 | else | ||
51 | output= | ||
52 | fi | ||
53 | COMPREPLY=($(compgen -f -- "$cur")) | ||
54 | return | ||
55 | ;; | ||
56 | esac | ||
57 | |||
58 | if [[ $cur == --* ]]; then | ||
59 | COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) | ||
60 | else | ||
61 | COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) | ||
62 | COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) | ||
63 | fi | ||
64 | |||
65 | } && | ||
66 | complete -F _swaylock swaylock | ||
diff --git a/completions/bash/swaymsg b/completions/bash/swaymsg new file mode 100644 index 00000000..8ec90b6f --- /dev/null +++ b/completions/bash/swaymsg | |||
@@ -0,0 +1,57 @@ | |||
1 | # swaymsg(1) completion | ||
2 | |||
3 | _swaymsg() | ||
4 | { | ||
5 | local cur prev | ||
6 | _get_comp_words_by_ref cur prev | ||
7 | |||
8 | types=( | ||
9 | 'get_workspaces' | ||
10 | 'get_seats' | ||
11 | 'get_inputs' | ||
12 | 'get_outputs' | ||
13 | 'get_tree' | ||
14 | 'get_marks' | ||
15 | 'get_bar_config' | ||
16 | 'get_version' | ||
17 | 'get_clipboard' | ||
18 | ) | ||
19 | |||
20 | short=( | ||
21 | -h | ||
22 | -q | ||
23 | -r | ||
24 | -s | ||
25 | -t | ||
26 | -v | ||
27 | ) | ||
28 | |||
29 | long=( | ||
30 | --help | ||
31 | --quiet | ||
32 | --raw | ||
33 | --socket | ||
34 | --type | ||
35 | --verbose | ||
36 | ) | ||
37 | |||
38 | case $prev in | ||
39 | -s|--socket) | ||
40 | _filedir | ||
41 | return | ||
42 | ;; | ||
43 | -t|--type) | ||
44 | COMPREPLY=($(compgen -W "${types[*]}" -- "$cur")) | ||
45 | return | ||
46 | ;; | ||
47 | esac | ||
48 | |||
49 | if [[ $cur == --* ]]; then | ||
50 | COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) | ||
51 | else | ||
52 | COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) | ||
53 | COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) | ||
54 | fi | ||
55 | |||
56 | } && | ||
57 | complete -F _swaymsg swaymsg | ||