Debian Codegraph @

bash-completion/mount

raw
1 _mount_module()
2 {
3 local cur prev OPTS
4 COMPREPLY=()
5 cur="${COMP_WORDS[COMP_CWORD]}"
6 prev="${COMP_WORDS[COMP_CWORD-1]}"
7 case $prev in
8 '-t'|'--types')
9 local prefix realcur TYPES
10 TYPES="
11 $(command ls /lib/modules/$(command uname -r)/kernel/fs | command awk '{print $1, "no" $1}')
12 $(command awk '{print $NF, "no" $NF}' /proc/filesystems)
13 "
14 realcur="${cur##*,}"
15 prefix="${cur%$realcur}"
16 for WORD in $TYPES; do
17 if ! [[ $prefix == *"$WORD"* ]]; then
18 TYPE_COLS="$WORD ${TYPE_COLS:-""}"
19 fi
20 done
21 compopt -o nospace
22 COMPREPLY=( $(compgen -P "$prefix" -W "$TYPE_COLS" -S ',' -- $realcur) )
23 return 0
24 ;;
25 '-L'|'--label')
26 local LABELS
27 LABELS="$(command lsblk -o LABEL -nr)"
28 COMPREPLY=( $(compgen -W "$LABELS" -- $cur) )
29 return 0
30 ;;
31 '-U'|'--uuid')
32 local UUIDS
33 UUIDS="$(command lsblk -o UUID -nr)"
34 COMPREPLY=( $(compgen -W "$UUIDS" -- $cur) )
35 return 0
36 ;;
37 '-N'|'--namespace')
38 local NAMESPACE
39 NAMESPACE="$(command lsns --type mnt --output PATH --noheadings)"
40 COMPREPLY=( $(compgen -W "$NAMESPACE" -- $cur) )
41 return 0
42 ;;
43 '--options-mode')
44 COMPREPLY=( $(compgen -W "ignore append prepend replace" -- $cur) )
45 return 0
46 ;;
47 '--options-source')
48 COMPREPLY=( $(compgen -W "fstab mtab disable" -- $cur) )
49 return 0
50 ;;
51 '-h'|'--help'|'-V'|'--version')
52 return 0
53 ;;
54 esac
55 case $cur in
56 -*)
57 OPTS=" --all
58 --exclusive
59 --beneath
60 --no-canonicalize
61 --fake
62 --fork
63 --fstab
64 --help
65 --internal-only
66 --show-labels
67 --no-mtab
68 --onlyonce
69 --options
70 --options-mode
71 --options-source
72 --options-source-force
73 --test-opts
74 --read-only
75 --ro
76 --types
77 --source
78 --target
79 --target-prefix
80 --verbose
81 --version
82 --rw
83 --read-write
84 --namespace
85 --label
86 --uuid
87 --bind
88 --move
89 --rbind
90 --map-groups
91 --map-users
92 --make-shared
93 --make-slave
94 --make-private
95 --make-unbindable
96 --make-rshared
97 --make-rslave
98 --make-rprivate
99 --make-runbindable
100 --mkdir"
101 COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
102 return 0
103 ;;
104 esac
105 local IFS=$'\n'
106 compopt -o filenames
107 COMPREPLY=( $(compgen -f -- $cur) )
108 return 0
109 }
110 complete -F _mount_module mount