author | František Kučera <franta-hg@frantovo.cz> |
Sat, 27 Nov 2021 23:15:15 +0100 | |
branch | v_0 |
changeset 26 | b4c4c7f937e9 |
parent 25 | f71eb7aefd25 |
permissions | -rw-r--r-- |
25
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
1 |
# Relational pipes |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
2 |
# Copyright © 2021 František Kučera (Frantovo.cz, GlobalCode.info) |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
3 |
# |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
4 |
# This program is free software: you can redistribute it and/or modify |
f71eb7aefd25
add CLIParser and Configuration: --relation option
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 |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
6 |
# the Free Software Foundation, version 3 of the License. |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
7 |
# |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
8 |
# This program is distributed in the hope that it will be useful, |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
9 |
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
10 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
11 |
# GNU General Public License for more details. |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
12 |
# |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
13 |
# You should have received a copy of the GNU General Public License |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
14 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
15 |
|
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
16 |
_relpipe_in_fstab_completion() { |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
17 |
local w0 w1 w2 w3 |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
18 |
|
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
19 |
COMPREPLY=() |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
20 |
w0=${COMP_WORDS[COMP_CWORD]} |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
21 |
w1=${COMP_WORDS[COMP_CWORD-1]} |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
22 |
w2=${COMP_WORDS[COMP_CWORD-2]} |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
23 |
w3=${COMP_WORDS[COMP_CWORD-3]} |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
24 |
|
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
25 |
if [[ "$w1" == "--relation" && "x$w0" == "x" ]]; then COMPREPLY=("''") |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
26 |
else |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
27 |
OPTIONS=( |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
28 |
"--relation" |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
29 |
) |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
30 |
COMPREPLY=($(compgen -W "${OPTIONS[*]}" -- "$w0")) |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
31 |
fi |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
32 |
} |
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
33 |
|
f71eb7aefd25
add CLIParser and Configuration: --relation option
František Kučera <franta-hg@frantovo.cz>
parents:
diff
changeset
|
34 |
complete -F _relpipe_in_fstab_completion relpipe-in-fstab |