@@ -28,14 +28,18 @@ _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
4145 --fsck
@@ -49,14 +53,27 @@ _systemd_dissect() {
4953
5054 _init_completion || return
5155
56+ if __contains_word " $prev_1 " ${OPTS[STANDALONE]} ; then
57+ case $prev_1 in
58+ -h|--help|--version|--discover)
59+ return 0
60+ ;;
61+ esac
62+ fi
63+
64+ if [[ " $cur " = -* ]]; then
65+ COMPREPLY=( $( compgen -W ' ${OPTS[*]}' -- " $cur " ) )
66+ return 0
67+ fi
68+
5269 if __contains_word " $prev_1 " ${OPTS[ARG]} ; then
5370 case $prev_1 in
54- -l|--list|-m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data)
71+ -l|--list|--mtree|- m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data|--with )
5572 comps=$( compgen -A file -- " $cur " )
5673 compopt -o filenames
5774 ;;
5875 -u|--umount|-U)
59- comps=$( compgen -A directory -- " $cur " )
76+ comps=$( compgen -A directory -- " $cur " )
6077 compopt -o dirnames
6178 ;;
6279 --fsck|--growfs)
@@ -80,23 +97,22 @@ _systemd_dissect() {
8097 if __contains_word " $prev_2 " ${OPTS[ARG]} ; then
8198 case $prev_2 in
8299 -m|--mount|-M)
83- comps=$( compgen -A directory -- " $cur " )
100+ comps=$( compgen -A directory -- " $cur " )
84101 compopt -o dirnames
85102 ;;
103+ --with)
104+ comps=$( compgen -A command -- " $cur " )
105+ compopt -o filenames
106+ ;;
86107 * )
87- comps=$( compgen -A file -- " $cur " )
108+ comps=$( compgen -A file -- " $cur " )
88109 compopt -o filenames
89110 ;;
90111 esac
91112 COMPREPLY=( $( compgen -W ' $comps' -- " $cur " ) )
92113 return 0
93114 fi
94115
95- if [[ " $cur " = -* ]]; then
96- COMPREPLY=( $( compgen -W ' ${OPTS[*]}' -- " $cur " ) )
97- return 0
98- fi
99-
100116 COMPREPLY=( $( compgen -A file -- " $cur " ) )
101117 compopt -o filenames
102118 return 0
0 commit comments