diff options
author | 2018-07-30 13:11:20 -0400 | |
---|---|---|
committer | 2018-07-30 13:11:20 -0400 | |
commit | 878d1ddd07b5ce452d3d7e1606f20f8560f2f11b (patch) | |
tree | 742714aeaff5118afabf0cb2179040655510e9df /completions/bash/swaymsg | |
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/bash/swaymsg')
-rw-r--r-- | completions/bash/swaymsg | 57 |
1 files changed, 57 insertions, 0 deletions
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 | ||