From a0582220f5fe4927487bbfd4d56d2c1abd964e4a Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Mon, 25 Sep 2023 16:16:41 +0200 Subject: [PATCH 1/2] man/systemd-dissect: various fixes - Add synopsis to `--discover` and `--validate` options. - `-l` is for `--list`, not for `--mtree`. --- man/systemd-dissect.xml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/man/systemd-dissect.xml b/man/systemd-dissect.xml index 078ee50857..3c758ba62e 100644 --- a/man/systemd-dissect.xml +++ b/man/systemd-dissect.xml @@ -53,6 +53,12 @@ systemd-dissect OPTIONS IMAGE SOURCE PATH + + systemd-dissect OPTIONS + + + systemd-dissect OPTIONS IMAGE + @@ -222,7 +228,6 @@ - Generates a BSD mtree8 From acb7d23d8f91cc0f93c82481f92d540ac45311b1 Mon Sep 17 00:00:00 2001 From: Antonio Alvarez Feijoo Date: Mon, 25 Sep 2023 16:46:11 +0200 Subject: [PATCH 2/2] bash-completion: add missing commands and options to systemd-dissect --- shell-completion/bash/systemd-dissect | 44 +++++++++++++++++++-------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/shell-completion/bash/systemd-dissect b/shell-completion/bash/systemd-dissect index 275ef6ba8d..4bb203a2f8 100644 --- a/shell-completion/bash/systemd-dissect +++ b/shell-completion/bash/systemd-dissect @@ -28,38 +28,59 @@ _systemd_dissect() { local cur=${COMP_WORDS[COMP_CWORD]} prev_1=${COMP_WORDS[COMP_CWORD-1]} prev_2=${COMP_WORDS[COMP_CWORD-2]} words cword local -A OPTS=( [STANDALONE]='-h --help --version + --discover --no-pager --no-legend -r --read-only --mkdir - --rmdir' + --rmdir + --in-memory' [ARG]='-m --mount -M -u --umount -U -l --list + --mtree + --with -x --copy-from -a --copy-to + --validate --fsck --growfs --discard --root-hash --root-hash-sig --verity-data - --json' + --image-policy + --json + --loop-ref + --mtree-hash' ) _init_completion || return + if __contains_word "$prev_1" ${OPTS[STANDALONE]}; then + case $prev_1 in + -h|--help|--version|--discover) + return 0 + ;; + esac + fi + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + if __contains_word "$prev_1" ${OPTS[ARG]}; then case $prev_1 in - -l|--list|-m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data) + -l|--list|--mtree|-m|--mount|-M|-x|--copy-from|-a|--copy-to|--verity-data|--validate|--with) comps=$(compgen -A file -- "$cur") compopt -o filenames ;; -u|--umount|-U) - comps=$(compgen -A directory -- "$cur" ) + comps=$(compgen -A directory -- "$cur") compopt -o dirnames ;; - --fsck|--growfs) + --fsck|--growfs|--mtree-hash) comps='yes no' ;; --discard) @@ -80,11 +101,15 @@ _systemd_dissect() { if __contains_word "$prev_2" ${OPTS[ARG]}; then case $prev_2 in -m|--mount|-M) - comps=$(compgen -A directory -- "$cur" ) + comps=$(compgen -A directory -- "$cur") compopt -o dirnames ;; + --with) + comps=$(compgen -A command -- "$cur") + compopt -o filenames + ;; *) - comps=$(compgen -A file -- "$cur" ) + comps=$(compgen -A file -- "$cur") compopt -o filenames ;; esac @@ -92,11 +117,6 @@ _systemd_dissect() { return 0 fi - if [[ "$cur" = -* ]]; then - COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) - return 0 - fi - COMPREPLY=( $(compgen -A file -- "$cur") ) compopt -o filenames return 0