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/bash/swaylock | |
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/swaylock')
-rw-r--r-- | completions/bash/swaylock | 66 |
1 files changed, 66 insertions, 0 deletions
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 | ||