author | František Kučera <franta-hg@frantovo.cz> |
Tue, 09 Jun 2020 16:29:12 +0200 | |
branch | v_0 |
changeset 30 | 148bda718c93 |
permissions | -rw-r--r-- |
30
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
# cadMousePro |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
# Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
# |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
# This program is free software: you can redistribute it and/or modify |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
5 |
# it under the terms of the GNU General Public License as published by |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
# the Free Software Foundation, version 3 of the License. |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
# |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
# This program is distributed in the hope that it will be useful, |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
# GNU General Public License for more details. |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
# |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
# You should have received a copy of the GNU General Public License |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
_cadMousePro_completion() { |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
local w0 w1 w2 |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
COMPREPLY=() |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
w0=${COMP_WORDS[COMP_CWORD]} |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
w1=${COMP_WORDS[COMP_CWORD-1]} |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
w2=${COMP_WORDS[COMP_CWORD-2]} |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
BOOLEAN=( |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
"true" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
"false" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
FREQUENCY=( |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
"125" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
"250" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
"500" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
"1000" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
35 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
36 |
if [[ "$w1" == "--frequency" ]]; then COMPREPLY=($(compgen -W "${FREQUENCY[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
37 |
elif [[ "$w1" == "--smart-scrolling" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
38 |
elif [[ "$w1" == "--lift-off-detection" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
39 |
elif [[ "$w1" == "--remap-wheel-press" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
40 |
elif [[ "$w1" == "--remap-gesture-button" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
41 |
elif [[ "$w1" == "--daemon" ]]; then COMPREPLY=($(compgen -W "${BOOLEAN[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
42 |
else |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
43 |
OPTIONS=( |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
44 |
"--frequency" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
45 |
"--smart-scrolling" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
46 |
"--lift-off-detection" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
47 |
"--remap-wheel-press" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
48 |
"--remap-gesture-button" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
49 |
"--daemon" |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
50 |
) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
51 |
COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
52 |
fi |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
53 |
} |
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
54 |
|
148bda718c93
Bash completion script
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
55 |
complete -F _cadMousePro_completion cadMousePro |