Skip to content

Commit 6450d4e

Browse files
aafeijoo-susekeszybz
authored andcommitted
bash-completion: add missing commands and options to systemd-dissect
(cherry picked from commit acb7d23)
1 parent 44b29d9 commit 6450d4e

File tree

1 file changed

+32
-12
lines changed

1 file changed

+32
-12
lines changed

shell-completion/bash/systemd-dissect

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,38 +28,59 @@ _systemd_dissect() {
2828
local cur=${COMP_WORDS[COMP_CWORD]} prev_1=${COMP_WORDS[COMP_CWORD-1]} prev_2=${COMP_WORDS[COMP_CWORD-2]} words cword
2929
local -A OPTS=(
3030
[STANDALONE]='-h --help --version
31+
--discover
3132
--no-pager
3233
--no-legend
3334
-r --read-only
3435
--mkdir
35-
--rmdir'
36+
--rmdir
37+
--in-memory'
3638
[ARG]='-m --mount -M
3739
-u --umount -U
3840
-l --list
41+
--mtree
42+
--with
3943
-x --copy-from
4044
-a --copy-to
45+
--validate
4146
--fsck
4247
--growfs
4348
--discard
4449
--root-hash
4550
--root-hash-sig
4651
--verity-data
47-
--json'
52+
--image-policy
53+
--json
54+
--loop-ref
55+
--mtree-hash'
4856
)
4957

5058
_init_completion || return
5159

60+
if __contains_word "$prev_1" ${OPTS[STANDALONE]}; then
61+
case $prev_1 in
62+
-h|--help|--version|--discover)
63+
return 0
64+
;;
65+
esac
66+
fi
67+
68+
if [[ "$cur" = -* ]]; then
69+
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
70+
return 0
71+
fi
72+
5273
if __contains_word "$prev_1" ${OPTS[ARG]}; then
5374
case $prev_1 in
54-
-l|--list|-m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data)
75+
-l|--list|--mtree|-m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data|--validate|--with)
5576
comps=$(compgen -A file -- "$cur")
5677
compopt -o filenames
5778
;;
5879
-u|--umount|-U)
59-
comps=$(compgen -A directory -- "$cur" )
80+
comps=$(compgen -A directory -- "$cur")
6081
compopt -o dirnames
6182
;;
62-
--fsck|--growfs)
83+
--fsck|--growfs|--mtree-hash)
6384
comps='yes no'
6485
;;
6586
--discard)
@@ -80,23 +101,22 @@ _systemd_dissect() {
80101
if __contains_word "$prev_2" ${OPTS[ARG]}; then
81102
case $prev_2 in
82103
-m|--mount|-M)
83-
comps=$(compgen -A directory -- "$cur" )
104+
comps=$(compgen -A directory -- "$cur")
84105
compopt -o dirnames
85106
;;
107+
--with)
108+
comps=$(compgen -A command -- "$cur")
109+
compopt -o filenames
110+
;;
86111
*)
87-
comps=$(compgen -A file -- "$cur" )
112+
comps=$(compgen -A file -- "$cur")
88113
compopt -o filenames
89114
;;
90115
esac
91116
COMPREPLY=( $(compgen -W '$comps' -- "$cur") )
92117
return 0
93118
fi
94119

95-
if [[ "$cur" = -* ]]; then
96-
COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") )
97-
return 0
98-
fi
99-
100120
COMPREPLY=( $(compgen -A file -- "$cur") )
101121
compopt -o filenames
102122
return 0

0 commit comments

Comments
 (0)