diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 03:50:40 +0000 |
commit | fc53809803cd2bc2434e312b19a18fa36776da12 (patch) | |
tree | b4b43bd6538f51965ce32856e9c053d0f90919c8 /shell-completion/bash | |
parent | Adding upstream version 255.5. (diff) | |
download | systemd-fc53809803cd2bc2434e312b19a18fa36776da12.tar.xz systemd-fc53809803cd2bc2434e312b19a18fa36776da12.zip |
Adding upstream version 256.upstream/256
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'shell-completion/bash')
37 files changed, 588 insertions, 65 deletions
diff --git a/shell-completion/bash/bootctl b/shell-completion/bash/bootctl index 8d8b507..45fcd50 100644 --- a/shell-completion/bash/bootctl +++ b/shell-completion/bash/bootctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # bootctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl index 5464225..bb80c17 100644 --- a/shell-completion/bash/busctl +++ b/shell-completion/bash/busctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # busctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/coredumpctl b/shell-completion/bash/coredumpctl index b571990..ebab360 100644 --- a/shell-completion/bash/coredumpctl +++ b/shell-completion/bash/coredumpctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # coredumpctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/homectl b/shell-completion/bash/homectl index 0a7bd0d..5e2235b 100644 --- a/shell-completion/bash/homectl +++ b/shell-completion/bash/homectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # homectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -106,7 +107,12 @@ _homectl() { --cifs-service --stop-delay --kill-processes - --auto-login' + --auto-login + -b --blob + --avatar + --login-background + --session-launcher + --session-type' ) if __contains_word "$prev" ${OPTS[ARG]}; then @@ -117,7 +123,7 @@ _homectl() { --machine|-M) comps=$( __get_machines ) ;; - --identity|--image-path) + --identity|--image-path|--avatar|--login-background) comps=$(compgen -A file -- "$cur" ) compopt -o filenames ;; @@ -130,7 +136,7 @@ _homectl() { --locked|--enforce-password-policy|--password-change-now|--luks-discard|--luks-offline-discard|--nosuid|--nodev|--noexec|--kill-processes|--auto-login) comps='yes no' ;; - -d|--home-dir|--skel) + -d|--home-dir|--skel|-b|--blob) comps=$(compgen -A directory -- "$cur" ) compopt -o dirnames ;; @@ -146,6 +152,15 @@ _homectl() { --cifs-user-name) comps=$(compgen -A user -- "$cur" ) ;; + --language) + comps=$(localectl list-locales 2>/dev/null) + ;; + --session-launcher) + comps=$(find /usr/share/{x,wayland-}sessions/ -type f -name '*.desktop' -exec basename {} .desktop \; 2>/dev/null | sort -u) + ;; + --session-type) + comps='wayland x11 tty' + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index 63edc08..d8256a9 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # hostnamectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -35,7 +36,7 @@ _hostnamectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='-h --help --version --transient --static --pretty --no-ask-password' + [STANDALONE]='-h --help --version --transient --static --pretty --no-ask-password -j' [ARG]='-H --host -M --machine --json' ) diff --git a/shell-completion/bash/importctl b/shell-completion/bash/importctl new file mode 100644 index 0000000..d8187d0 --- /dev/null +++ b/shell-completion/bash/importctl @@ -0,0 +1,125 @@ +# shellcheck shell=bash +# importctl(1) completion -*- shell-script -*- +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <https://www.gnu.org/licenses/>. + +__contains_word() { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done +} + +__get_machines() { + local a b + { machinectl list-images --full --no-legend --no-pager 2>/dev/null; machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \ + { while read a b; do echo " $a"; done; } | \ + sort -u +} + +_importctl() { + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword + local i verb comps + + local -A OPTS=( + [STANDALONE]='--force -h --help -j -N --no-ask-password --no-legend --no-pager -q --quiet --read-only + --version -m -P -S -C' + [ARG]='--host -H -M --machine --json --verify --format --class --keep-download' + ) + + local -A VERBS=( + [STANDALONE]='pull-tar pull-raw list-transfers cancel-transfer list-images' + [FILE]='import-tar import-raw' + [FILE2]='export-tar export-raw' + [DIR]='import-fs' + ) + + _init_completion || return + + for ((i=0; i <= COMP_CWORD; i++)); do + if __contains_word "${COMP_WORDS[i]}" ${VERBS[*]} && + ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then + verb=${COMP_WORDS[i]} + break + fi + done + + if __contains_word "$prev" ${OPTS[ARG]}; then + case $prev in + --host|-H) + comps=$(compgen -A hostname) + ;; + --machine|-M) + comps=$( __get_machines ) + ;; + --json) + comps='pretty short off' + ;; + --verify) + comps='no checksum signature' + ;; + --format) + comps='uncompressed xz gzip bzip2' + ;; + --class) + comps='machine portable sysext confext' + ;; + --keep-download) + comps='yes no' + ;; + esac + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + + if [[ -z ${verb-} ]]; then + comps=${VERBS[*]} + elif __contains_word "$verb" ${VERBS[STANDALONE]}; then + comps='' + elif __contains_word "$verb" ${VERBS[DIR]}; then + if (( COMP_CWORD == i + 1 )); then # first argument after verb + comps=$(compgen -d -- "$cur") + compopt -o dirnames + else + comps='' + fi + elif __contains_word "$verb" ${VERBS[FILE]}; then + if (( COMP_CWORD == i + 1 )); then # first argument after verb + comps=$(compgen -f -- "$cur") + compopt -o filenames + else + comps='' + fi + elif __contains_word "$verb" ${VERBS[FILE2]}; then + if (( COMP_CWORD == i + 2 )); then # second argument after verb + comps=$(compgen -f -- "$cur") + compopt -o filenames + else + comps='' + fi + fi + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 +} + +complete -F _importctl importctl diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 067b053..c79a38c 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # journalctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -28,7 +29,7 @@ __contains_word () { __get_machines() { local a b { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \ - { while read a b; do echo " $a"; done; } | \ + { while read a b; do echo " $a"; done; } | \ sort -u } @@ -45,10 +46,12 @@ _journalctl() { --version --list-catalog --update-catalog --list-boots --show-cursor --dmesg -k --pager-end -e -r --reverse --utc -x --catalog --no-full --force --dump-catalog - --flush --rotate --sync --no-hostname -N --fields' - [ARG]='-b --boot -D --directory --file -F --field -t --identifier --facility - -M --machine -o --output -u --unit --user-unit -p --priority - --root --case-sensitive' + --flush --rotate --sync --no-hostname -N --fields + --list-namespaces' + [ARG]='-b --boot -D --directory --file -F --field -t --identifier + -T --exclude-identifier --facility -M --machine -o --output + -u --unit --user-unit -p --priority --root --case-sensitive + --namespace' [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until --after-cursor --cursor-file --verify-key -g --grep --vacuum-size --vacuum-time --vacuum-files --output-fields' @@ -107,12 +110,15 @@ _journalctl() { --user-unit) comps=$(journalctl -F '_SYSTEMD_USER_UNIT' 2>/dev/null) ;; - --identifier|-t) + --identifier|-t|--exclude-identifier|-T) comps=$(journalctl -F 'SYSLOG_IDENTIFIER' 2>/dev/null) ;; --case-sensitive) comps='yes no' ;; + --namespace) + comps=$(journalctl --list-namespaces --output=cat 2>/dev/null) + ;; *) return 0 ;; diff --git a/shell-completion/bash/kernel-install b/shell-completion/bash/kernel-install index 4708777..d3a9d9b 100644 --- a/shell-completion/bash/kernel-install +++ b/shell-completion/bash/kernel-install @@ -1,3 +1,4 @@ +# shellcheck shell=bash # kernel-install(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl index b601343..1717842 100644 --- a/shell-completion/bash/localectl +++ b/shell-completion/bash/localectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # localectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl index b307e42..7dbd9c0 100644 --- a/shell-completion/bash/loginctl +++ b/shell-completion/bash/loginctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # loginctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -42,9 +43,9 @@ _loginctl () { local -A OPTS=( [STANDALONE]='--all -a --help -h --no-pager --version - --no-legend --no-ask-password -l --full --value' + --no-legend --no-ask-password -l --full --value -j' [ARG]='--host -H --kill-whom --property -p --signal -s -M --machine - -n --lines -o --output -P' + -n --lines -o --output -P --json' ) if __contains_word "$prev" ${OPTS[ARG]}; then @@ -68,6 +69,9 @@ _loginctl () { --output|-o) comps=$( loginctl --output=help 2>/dev/null ) ;; + --json) + comps=$( loginctl --json=help 2>/dev/null ) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl index b28769b..b3c2e50 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # machinectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -106,8 +107,12 @@ _machinectl() { comps=$( __get_machines ) elif __contains_word "$verb" ${VERBS[FILE]}; then - comps=$(compgen -f -- "cur") - compopt -o filenames + if (( COMP_CWORD == i + 1 )); then # first argument after verb + comps=$(compgen -f -- "$cur") + compopt -o filenames + else + comps='' + fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/meson.build b/shell-completion/bash/meson.build index 1588b53..91635df 100644 --- a/shell-completion/bash/meson.build +++ b/shell-completion/bash/meson.build @@ -30,11 +30,14 @@ items = [['busctl', ''], ['systemd-nspawn', ''], ['systemd-path', ''], ['systemd-run', ''], + ['systemd-vpick', ''], ['udevadm', ''], ['bootctl', ''], + ['run0', ''], ['coredumpctl', 'ENABLE_COREDUMP'], ['homectl', 'ENABLE_HOMED'], ['hostnamectl', 'ENABLE_HOSTNAMED'], + ['importctl', 'ENABLE_IMPORTD'], ['kernel-install', 'ENABLE_KERNEL_INSTALL'], ['localectl', 'ENABLE_LOCALED'], ['loginctl', 'ENABLE_LOGIND'], @@ -44,9 +47,11 @@ items = [['busctl', ''], ['portablectl', 'ENABLE_PORTABLED'], ['resolvectl', 'ENABLE_RESOLVE'], ['systemd-cryptenroll', 'HAVE_LIBCRYPTSETUP'], + ['systemd-confext', 'ENABLE_SYSEXT'], ['systemd-dissect', 'HAVE_BLKID'], ['systemd-resolve', 'ENABLE_RESOLVE'], ['systemd-sysext', 'ENABLE_SYSEXT'], + ['systemd-vmspawn', 'ENABLE_VMSPAWN'], ['timedatectl', 'ENABLE_TIMEDATED']] foreach item : items diff --git a/shell-completion/bash/networkctl b/shell-completion/bash/networkctl index db59a9c..6c9daa7 100644 --- a/shell-completion/bash/networkctl +++ b/shell-completion/bash/networkctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # networkctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -28,17 +29,32 @@ __get_links() { networkctl list --no-legend --no-pager --all --full | { while read -r a b c; do echo " $b"; done; }; } +__get_links_with_prefix() { + local i + for i in $(__get_links); do + echo "@$i" + done +} + +__get_files() { + ls {/run,/usr/lib,/etc}/systemd/network/*.{network,netdev,link} 2>/dev/null +} + _networkctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( - [STANDALONE]='-a --all -h --help --version --no-pager --no-legend -s --stats -l --full' - [ARG]='-n --lines --json' + [STANDALONE]='-a --all -h --help --version --no-pager --no-legend -s --stats -l --full + --no-reload --runtime' + [ARG]='-n --lines --json --drop-in' ) local -A VERBS=( [STANDALONE]='label reload' [LINKS]='status list lldp delete renew up down forcerenew reconfigure' + [FILES_OR_LINKS]='edit cat' + [FILES]='mask unmask' + [BOOL]='persistent-storage' ) _init_completion || return @@ -54,7 +70,7 @@ _networkctl() { if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --json) - comps=$(networkctl --json=help | sort 2>/dev/null) + comps=$(networkctl --json=help) ;; *) return 0 @@ -75,6 +91,12 @@ _networkctl() { comps='' elif __contains_word "$verb" ${VERBS[LINKS]}; then comps=$( __get_links ) + elif __contains_word "$verb" ${VERBS[FILES_OR_LINKS]}; then + comps=$( __get_files; __get_links_with_prefix ) + elif __contains_word "$verb" ${VERBS[FILES]}; then + comps=$( __get_files ) + elif __contains_word "$verb" ${VERBS[BOOL]}; then + comps=$( yes no ) fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/oomctl b/shell-completion/bash/oomctl index dc45ba5..e1ad197 100644 --- a/shell-completion/bash/oomctl +++ b/shell-completion/bash/oomctl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # oomctl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/portablectl b/shell-completion/bash/portablectl index 30e5da4..8d88ab4 100644 --- a/shell-completion/bash/portablectl +++ b/shell-completion/bash/portablectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # portablectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -35,7 +36,8 @@ _portablectl() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-q --quiet --runtime --no-reload --cat --no-pager --no-legend - --no-ask-password --enable --now -h --help --version' + --no-ask-password --enable --now -h --help --version + --clean --no-block --force' [ARG]='-p --profile --copy -H --host -M --machine --extension' ) @@ -52,7 +54,7 @@ _portablectl() { comps="default nonetwork strict trusted" ;; --copy) - comps="copy symlink auto" + comps="copy symlink auto mixed" ;; --host|-H) comps=$(compgen -A hostname) diff --git a/shell-completion/bash/resolvectl b/shell-completion/bash/resolvectl index bd3e8bf..344eaad 100644 --- a/shell-completion/bash/resolvectl +++ b/shell-completion/bash/resolvectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # resolvectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -23,7 +24,7 @@ __contains_word () { done } -__get_interfaces(){ +__get_interfaces() { local name for name in $(cd /sys/class/net && command ls); do [[ "$name" != "lo" ]] && echo "$name" @@ -35,10 +36,10 @@ _resolvectl() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [STANDALONE]='-h --help --version -4 -6 --legend=no --cname=no - --validate=no --synthesize=no --cache=no --zone=no + --validate=no --synthesize=no --cache=no --relax-single-label=no --zone=no --trust-anchor=no --network=no --service-address=no --service-txt=no --search=no --stale-data=no --no-pager' - [ARG]='-t --type -c --class -i --interface -p --protocol --raw' + [ARG]='-t --type -c --class -i --interface -p --protocol --raw --json' ) local -A VERBS=( [DOMAIN]='query service openpgp' @@ -49,7 +50,7 @@ _resolvectl() { [RESOLVE]='llmnr mdns' [DNSSEC]='dnssec' [DNSOVERTLS]='dnsovertls' - [STANDALONE]='statistics reset-statistics flush-caches reset-server-features show-cache' + [STANDALONE]='statistics reset-statistics flush-caches reset-server-features monitor show-cache show-server-state' [LOG_LEVEL]='log-level' ) local -A ARGS=( @@ -59,14 +60,13 @@ _resolvectl() { [DNSSEC]='yes no allow-downgrade' [DNSOVERTLS]='yes no opportunistic' ) - local interfaces=$( __get_interfaces ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in --interface|-i) - comps="$interfaces" + comps=$( __get_interfaces ) ;; - --protocol|-p|--type|-t|--class|-c) + --protocol|-p|--type|-t|--class|-c|--json) comps=$( resolvectl --legend=no "$prev" help; echo help ) ;; --raw) @@ -97,7 +97,7 @@ _resolvectl() { comps='' elif __contains_word "$verb" ${VERBS[STATUS]}; then - comps="$interfaces" + comps=$( __get_interfaces ) elif __contains_word "$verb" ${VERBS[LOG_LEVEL]}; then comps='debug info notice warning err crit alert emerg' @@ -117,6 +117,7 @@ _resolvectl() { fi elif __contains_word "$verb" ${VERBS[LINK]} ${VERBS[BOOLEAN]} ${VERBS[RESOLVE]} ${VERBS[DNSSEC]} ${VERBS[DNSOVERTLS]}; then + local interfaces=$( __get_interfaces ) for ((i++; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" $interfaces && ! __contains_word "${COMP_WORDS[i-1]}" ${OPTS[ARG]}; then diff --git a/shell-completion/bash/run0 b/shell-completion/bash/run0 new file mode 100644 index 0000000..96610e4 --- /dev/null +++ b/shell-completion/bash/run0 @@ -0,0 +1,113 @@ +# shellcheck shell=bash +# run0(1) completion -*- shell-script -*- +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <https://www.gnu.org/licenses/>. + +__systemctl() { + systemctl --system --full --no-legend --no-pager --plain "$@" +} + +__get_slice_units () { __systemctl list-units --all -t slice \ + | { while read -r a b c d; do echo " $a"; done; }; } + +__get_machines() { + local a b + { machinectl list --full --max-addresses=0 --no-legend --no-pager 2>/dev/null; echo ".host"; } | \ + { while read a b; do echo " $a"; done; } | \ + sort -u +} + +_run0() { + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} + local opts_with_values=( + --machine --unit --property --description --slice -u --user -g --group --nice -D --chdir + --setenv --background + ) + local OPTS="${opts_with_values[*]} -h --help -V --version --no-ask-password --slice-inherit" + + local i + for (( i=1; i <= COMP_CWORD; i++ )); do + if [[ ${COMP_WORDS[i]} != -* ]]; then + local root_command=${COMP_WORDS[i]} + _command_offset ${i} + return + fi + + [[ ${i} -lt ${COMP_CWORD} && " ${opts_with_values[@]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++)) + done + + case "${prev}" in + --unit|--description|--nice|--setenv|--background) + # argument required but no completions available + return + ;; + --slice) + local comps=$(__get_slice_units) + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; + --property) + local comps='CPUAccounting= MemoryAccounting= BlockIOAccounting= SendSIGHUP= + SendSIGKILL= MemoryLimit= CPUShares= BlockIOWeight= User= Group= + DevicePolicy= KillMode= ExitType= DeviceAllow= BlockIOReadBandwidth= + BlockIOWriteBandwidth= BlockIODeviceWeight= Nice= Environment= + KillSignal= RestartKillSignal= FinalKillSignal= LimitCPU= LimitFSIZE= LimitDATA= + LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= + LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= + LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= + PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= + TTYPath= SyslogIdentifier= SyslogLevelPrefix= SyslogLevel= + SyslogFacility= TimerSlackNSec= OOMScoreAdjust= ReadWritePaths= + ReadOnlyPaths= InaccessiblePaths= EnvironmentFile= + ProtectSystem= ProtectHome= RuntimeDirectory= PassEnvironment=' + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; + --machine) + local comps=$( __get_machines ) + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; + -u|--user) + COMPREPLY=($(compgen -u -- "$cur")) + return 0 + ;; + -g|--group) + COMPREPLY=($(compgen -g -- "$cur")) + return 0 + ;; + -D|--chdir) + local comps + if [[ -z $cur ]]; then + comps=$(compgen -A directory -- "/" ) + else + comps=$(compgen -A directory -- "$cur" ) + fi + compopt -o filenames + COMPREPLY=( $(compgen -W '$comps' -- "$cur" ) ) + return 0 + ;; + esac + + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 +} + +complete -F _run0 run0 diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 5c444b7..f4576c4 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemctl(1) completion -*- shell-script -*- # vi: ft=sh # SPDX-License-Identifier: LGPL-2.1-or-later @@ -192,7 +193,7 @@ _systemctl () { comps='auto yes no' ;; --what) - comps='configuration state cache logs runtime all' + comps='configuration state cache logs runtime fdstore all' ;; --image) comps=$(compgen -A file -- "$cur") diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 1fde672..75ea1dc 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-analyze(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -51,6 +52,10 @@ __get_syscall_sets() { done } +__get_architectures() { + systemd-analyze --no-legend --no-pager architectures | { while read -r a b; do echo " $a"; done } +} + _systemd_analyze() { local i verb comps mode local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword @@ -62,7 +67,7 @@ _systemd_analyze() { ) local -A VERBS=( - [STANDALONE]='time blame unit-paths exit-status calendar timestamp timespan' + [STANDALONE]='time blame unit-files unit-paths exit-status capability compare-versions calendar timestamp timespan pcrs srk' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [DUMP]='dump' @@ -73,11 +78,13 @@ _systemd_analyze() { [CONDITION]='condition' [INSPECT_ELF]='inspect-elf' [PLOT]='plot' + [ARCHITECTURES]='architectures' + [FDSTORE]='fdstore' ) - local CONFIGS='systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf + local CONFIGS='locale.conf systemd/bootchart.conf systemd/coredump.conf systemd/journald.conf systemd/journal-remote.conf systemd/journal-upload.conf systemd/logind.conf - systemd/resolved.conf systemd/networkd.conf systemd/resolved.conf + systemd/resolved.conf systemd/networkd.conf systemd/pstore.conf systemd/resolved.conf systemd/sleep.conf systemd/system.conf systemd/timedated.conf systemd/timesyncd.conf systemd/user.conf udev/udev.conf' @@ -198,6 +205,20 @@ _systemd_analyze() { if [[ $cur = -* ]]; then comps='--help --version --system --user --global --no-pager --json=off --json=pretty --json=short --table --no-legend' fi + + elif __contains_word "$verb" ${VERBS[ARCHITECTURES]}; then + if [[ $cur = -* ]]; then + comps='--help --version --no-pager --json=off --json=pretty --json=short --no-legend' + else + comps=$( __get_architectures ) + fi + + elif __contains_word "$verb" ${VERBS[FDSTORE]}; then + if [[ $cur = -* ]]; then + comps='--help --version --system --user --global -H --host -M --machine --no-pager --json=off --json=pretty --json=short --root --image' + else + comps=$( __get_services $mode ) + fi fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/systemd-cat b/shell-completion/bash/systemd-cat index b209140..0d7e3d7 100644 --- a/shell-completion/bash/systemd-cat +++ b/shell-completion/bash/systemd-cat @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-cat(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -30,7 +31,7 @@ _systemd_cat() { local -A OPTS=( [STANDALONE]='-h --help --version' - [ARG]='-t --identifier -p --priority --level-prefix' + [ARG]='-t --identifier -p --priority --stderr-priority --level-prefix --namespace' ) _init_completion || return @@ -40,12 +41,15 @@ _systemd_cat() { --identifier|-t) comps='' ;; - --priority|-p) + --priority|-p|--stderr-priority) comps='emerg alert crit err warning notice info debug' ;; --level-prefix) comps='yes no' ;; + --namespace) + comps=$(journalctl --list-namespaces --output=cat 2>/dev/null) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls index 8dda5a8..49739bd 100644 --- a/shell-completion/bash/systemd-cgls +++ b/shell-completion/bash/systemd-cgls @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-cgls(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -44,7 +45,7 @@ _systemd_cgls() { local -A OPTS=( [STANDALONE]='-h --help --version --all -l --full -k --no-pager --xattr=no --cgroup-id=no' - [ARG]='-M --machine -u --unit --user-unit' + [ARG]='-c --cgroup-id -M --machine -u --unit --user-unit -x --xattr' ) _init_completion || return @@ -57,6 +58,9 @@ _systemd_cgls() { --unit|-u) comps=$( __get_units_have_cgroup --system ) ;; + -c|--cgroup-id|-x|--xattr) + comps='yes no' + ;; --user-unit) comps=$( __get_units_have_cgroup --user ) ;; diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop index 731d9c9..6a33cb2 100644 --- a/shell-completion/bash/systemd-cgtop +++ b/shell-completion/bash/systemd-cgtop @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-cgtop(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-confext b/shell-completion/bash/systemd-confext index c8eca3b..d36f70f 100644 --- a/shell-completion/bash/systemd-confext +++ b/shell-completion/bash/systemd-confext @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-confext(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -30,9 +31,12 @@ _systemd-confext() { [STANDALONE]='-h --help --version --no-pager --no-legend + --no-reload --force' [ARG]='--root - --json' + --json + --noexec + --image-policy' ) local -A VERBS=( @@ -54,6 +58,12 @@ _systemd-confext() { --json) comps='pretty short off' ;; + --noexec) + comps='false true' + ;; + --image-policy) + comps='' + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-cryptenroll b/shell-completion/bash/systemd-cryptenroll index 1723f75..6b13e58 100644 --- a/shell-completion/bash/systemd-cryptenroll +++ b/shell-completion/bash/systemd-cryptenroll @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-cryptenroll(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -52,6 +53,7 @@ _systemd_cryptenroll() { --password --recovery-key' [ARG]='--unlock-key-file --unlock-fido2-device + --unlock-tpm2-device --pkcs11-token-uri --fido2-credential-algorithm --fido2-device @@ -81,6 +83,9 @@ _systemd_cryptenroll() { --unlock-fido2-device) comps="auto $(__get_fido2_devices)" ;; + --unlock-tpm2-device) + comps="auto $(__get_tpm2_devices)" + ;; --pkcs11-token-uri) comps='auto list pkcs11:' ;; diff --git a/shell-completion/bash/systemd-delta b/shell-completion/bash/systemd-delta index b148755..ac7f5e9 100644 --- a/shell-completion/bash/systemd-delta +++ b/shell-completion/bash/systemd-delta @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-delta(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-detect-virt b/shell-completion/bash/systemd-detect-virt index 9ade2af..edc861b 100644 --- a/shell-completion/bash/systemd-detect-virt +++ b/shell-completion/bash/systemd-detect-virt @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-detect-virt(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-dissect b/shell-completion/bash/systemd-dissect index 17fb642..8d2b434 100644 --- a/shell-completion/bash/systemd-dissect +++ b/shell-completion/bash/systemd-dissect @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-dissect(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-id128 b/shell-completion/bash/systemd-id128 index 1c19639..54d4ec8 100644 --- a/shell-completion/bash/systemd-id128 +++ b/shell-completion/bash/systemd-id128 @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-id128(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -28,12 +29,13 @@ _systemd_id128() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( - [STANDALONE]='-h --help --version -p --pretty' - [ARG]='-a --app-specific' + [STANDALONE]='-h --help --version -p --pretty --value -u --uuid --no-legend --no-pager -j' + [ARG]='-a --app-specific --json' ) local -A VERBS=( [STANDALONE]='new machine-id boot-id invocation-id help' + [ARG]='show' ) _init_completion || return @@ -43,6 +45,9 @@ _systemd_id128() { --app-specific|-a) comps="" ;; + --json) + comps="short pretty off" + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 @@ -65,6 +70,12 @@ _systemd_id128() { comps=${VERBS[*]} elif __contains_word "$verb" ${VERBS[STANDALONE]}; then comps='' + elif __contains_word "$verb" ${VERBS[ARG]}; then + case $verb in + show) + comps="$(IFS='\n ' systemd-id128 show --no-legend)" + ;; + esac fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index cc3d2f6..0a1761d 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-nspawn(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -68,19 +69,19 @@ _systemd_nspawn() { --keep-unit -n --network-veth -j -x --ephemeral -a --as-pid2 -U --suppress-sync=yes' [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine -S --slice -E --setenv -Z --selinux-context -L --selinux-apifs-context - --register --network-interface --network-bridge --personality -i --image --tmpfs + --register --network-interface --network-bridge --personality -i --image --image-policy --tmpfs --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash --chdir --pivot-root --property --private-users --private-users-ownership --network-namespace-path --network-ipvlan --network-veth-extra --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings --rlimit --hostname --no-new-privileges --oom-score-adjust --cpu-affinity - --resolv-conf --timezone --root-hash-sig' + --resolv-conf --timezone --root-hash-sig --background --oci-bundle --verity-data' ) _init_completion || return if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in - --directory|-D|--template) + --directory|-D|--template|--oci-bundle) compopt -o nospace comps=$(compgen -S/ -A directory -- "$cur" ) ;; diff --git a/shell-completion/bash/systemd-path b/shell-completion/bash/systemd-path index 40e2f7e..59d6597 100644 --- a/shell-completion/bash/systemd-path +++ b/shell-completion/bash/systemd-path @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-path(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-resolve b/shell-completion/bash/systemd-resolve index 20d904a..17890a9 100644 --- a/shell-completion/bash/systemd-resolve +++ b/shell-completion/bash/systemd-resolve @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-resolve(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index c18228d..4bc8206 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-run(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -33,21 +34,17 @@ __get_machines() { _systemd_run() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} - local OPTS='--no-ask-password --scope -u --unit -p --property --description --slice --slice-inherit - -r --remain-after-exit --send-sighup --service-type --uid --gid --nice - --working-directory -d --same-dir -E --setenv -t --pty -P --pipe -S --shell -q --quiet - --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar - --on-clock-change --on-timezone-change --path-property --socket-property - --timer-property --no-block --wait -G --collect --user --system -H --host -M --machine - -h --help --version' - - local mode=--system - local i local opts_with_values=( --unit -p --property --slice --description --service-type --uid --gid --nice --working-directory -E --setenv --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar - --path-property --socket-property --timer-property -H --host -M --machine + --path-property --socket-property --timer-property -H --host -M --machine --expand-environment + --background ) + local OPTS="${opts_with_values[*]} --no-ask-password --scope -u --slice-inherit -r --remain-after-exit + --send-sighup -d --same-dir -t --pty -P --pipe -S --shell -q --quiet --ignore-failure + --on-clock-change --on-timezone-change --no-block --wait -G --collect --user --system -h --help --version" + local mode=--system + local i for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then local root_command=${COMP_WORDS[i]} @@ -57,14 +54,20 @@ _systemd_run() { [[ ${COMP_WORDS[i]} == "--user" ]] && mode=--user - [[ $i -lt $COMP_CWORD && " ${opts_with_values[@]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++)) + [[ $i -lt $COMP_CWORD && " ${opts_with_values[*]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++)) done case "$prev" in - --unit|--description|--on-active|--on-boot|--on-startup|--on-unit-active|--on-unit-inactive|--on-calendar) + --unit|--description|--on-active|--on-boot|--on-startup|--on-unit-active|--on-unit-inactive|--on-calendar|--background) # argument required but no completions available return ;; + --expand-environment) + local comps='yes no' + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; --slice) local comps=$(__get_slice_units $mode) diff --git a/shell-completion/bash/systemd-sysext b/shell-completion/bash/systemd-sysext index b3f9f32..5c15f07 100644 --- a/shell-completion/bash/systemd-sysext +++ b/shell-completion/bash/systemd-sysext @@ -1,3 +1,4 @@ +# shellcheck shell=bash # systemd-sysext(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/systemd-vmspawn b/shell-completion/bash/systemd-vmspawn new file mode 100644 index 0000000..7043ce2 --- /dev/null +++ b/shell-completion/bash/systemd-vmspawn @@ -0,0 +1,70 @@ +# shellcheck shell=bash +# systemd-vmspawn(1) completion -*- shell-script -*- +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <https://www.gnu.org/licenses/>. + +__contains_word() { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done +} + +_systemd_vmspawn() { + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword + local i verb comps + + local -A OPTS=( + [STANDALONE]='-h --help --version -q --quiet --no-pager -n --network-tap --network-user-mode' + [PATH]='-D --directory -i --image --linux --initrd --extra-drive --forward-journal' + [BOOL]='--kvm --vsock --tpm --secure-boot --discard-disk --register --pass-ssh-key' + [FIRMWARE]='--firmware' + [BIND]='--bind --bind-ro' + [SSH_KEY]='--ssh-key' + [CONSOLE]='--console' + [ARG]='--cpus --ram --vsock-cid -M --machine --uuid--private-users --background --set-credential --load-credential' + ) + + _init_completion || return + + if __contains_word "$prev" ${OPTS[BOOL]}; then + comps='yes no' + elif __contains_word "$prev" ${OPTS[PATH]}; then + compopt -o nospace -o filenames + comps=$(compgen -f -- "$cur" ) + elif __contains_word "$prev" ${OPTS[FIRMWARE]}; then + compopt -o nospace -o filenames + comps="list $(compgen -f -- "$cur" )" + elif __contains_word "$prev" ${OPTS[BIND]}; then + compopt -o nospace -o filenames + comps=$(compgen -f -- "${cur}" ) + elif __contains_word "$prev" ${OPTS[SSH_KEY]}; then + comps='dsa ecdsa ecdsa-sk ed25519 ed25519-sk rsa' + elif __contains_word "$prev" ${OPTS[CONSOLE]}; then + comps='interactive native gui' + elif __contains_word "$prev" ${OPTS[ARG]}; then + comps='' + else + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + +} + +complete -F _systemd_vmspawn systemd-vmspawn diff --git a/shell-completion/bash/systemd-vpick b/shell-completion/bash/systemd-vpick new file mode 100644 index 0000000..7c67c0f --- /dev/null +++ b/shell-completion/bash/systemd-vpick @@ -0,0 +1,60 @@ +# shellcheck shell=bash +# systemd-vpick(1) completion -*- shell-script -*- +# SPDX-License-Identifier: LGPL-2.1-or-later +# +# This file is part of systemd. +# +# systemd is free software; you can redistribute it and/or modify it +# under the terms of the GNU Lesser General Public License as published by +# the Free Software Foundation; either version 2.1 of the License, or +# (at your option) any later version. +# +# systemd is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with systemd; If not, see <https://www.gnu.org/licenses/>. + +__contains_word() { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done +} + +_systemd-vpick() { + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword + local comps + + local -A OPTS=( + [STANDALONE]='--help -h --version' + [ARG]='-B --baseline -V -A -S --suffix --type -p --print --resolve' + ) + + _init_completion || return + + if __contains_word "$prev" ${OPTS[ARG]}; then + case $prev in + -p|--print) + comps='filename version type arch tries all' + ;; + --resolve) + comps='yes no' + ;; + esac + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi + + if [[ "$cur" = -* ]] || [[ -z ${comps-} ]]; then + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + + COMPREPLY=( $(compgen -W '${comps-}' -- "$cur") ) + return 0 +} + +complete -F _systemd-vpick systemd-vpick diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl index 768b4a5..f22cde2 100644 --- a/shell-completion/bash/timedatectl +++ b/shell-completion/bash/timedatectl @@ -1,3 +1,4 @@ +# shellcheck shell=bash # timedatectl(1) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm index 0606160..05f921c 100644 --- a/shell-completion/bash/udevadm +++ b/shell-completion/bash/udevadm @@ -1,3 +1,4 @@ +# shellcheck shell=bash # udevadm(8) completion -*- shell-script -*- # SPDX-License-Identifier: LGPL-2.1-or-later # @@ -30,7 +31,7 @@ __get_all_sysdevs() { printf '%s\n' "${devs[@]%/}" } -__get_all_devs() { +__get_all_device_nodes() { local i for i in /dev/* /dev/*/* /dev/*/*/*; do echo $i @@ -42,15 +43,23 @@ __get_all_device_units() { { while read -r a b; do echo "$a"; done; } } +__get_all_devices() { + __get_all_sysdevs + __get_all_device_nodes + __get_all_device_units +} + _udevadm() { local i verb comps builtin local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( [COMMON]='-h --help -V --version' [DEBUG]='-d --debug' - [INFO_STANDALONE]='-r --root -a --attribute-walk -x --export -e --export-db -c --cleanup-db - -w --wait-for-initialization --value' - [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file --property' + [INFO_STANDALONE]='-r --root -a --attribute-walk -t --tree -x --export -e --export-db -c --cleanup-db + -w --wait-for-initialization --value --no-pager --initialized-match --initialized-nomatch' + [INFO_ARG]='-q --query -p --path -n --name -P --export-prefix -d --device-id-of-file --property + --json --subsystem-match --subsystem-nomatch --attr-match --attr-nomatch --property-match + --tag-match --sysname-match --name-match --parent-match' [TRIGGER_STANDALONE]='-v --verbose -n --dry-run -q --quiet -w --settle --wait-daemon --uuid --initialized-match --initialized-nomatch' [TRIGGER_ARG]='-t --type -c --action -s --subsystem-match -S --subsystem-nomatch @@ -58,7 +67,8 @@ _udevadm() { -g --tag-match -y --sysname-match --name-match -b --parent-match --prioritized-subsystem' [SETTLE]='-t --timeout -E --exit-if-exists' - [CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping' + [CONTROL_STANDALONE]='-e --exit -s --stop-exec-queue -S --start-exec-queue -R --reload --ping + --load-credentials' [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout' [MONITOR_STANDALONE]='-k --kernel -u --udev -p --property' [MONITOR_ARG]='-s --subsystem-match -t --tag-match' @@ -100,7 +110,17 @@ _udevadm() { local IFS=$'\n' ;; -n|--name) - comps=$( __get_all_devs ) + comps=$( __get_all_device_nodes ) + ;; + --json) + comps=$( udevadm info --json=help ) + ;; + --parent-match) + comps=$( __get_all_sysdevs ) + local IFS=$'\n' + ;; + --name-match) + comps=$( __get_all_device_nodes ) ;; *) comps='' @@ -113,7 +133,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[INFO_STANDALONE]} ${OPTS[INFO_ARG]}" else - comps=$( __get_all_sysdevs; __get_all_device_units ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -132,7 +152,7 @@ _udevadm() { local IFS=$'\n' ;; --name-match) - comps=$( __get_all_devs ) + comps=$( __get_all_device_nodes ) ;; *) comps='' @@ -145,7 +165,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TRIGGER_STANDALONE]} ${OPTS[TRIGGER_ARG]}" else - comps=$( __get_all_sysdevs; __get_all_device_units ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -215,7 +235,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TEST]}" else - comps=$( __get_all_sysdevs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -243,7 +263,7 @@ _udevadm() { elif [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[TEST_BUILTIN]}" else - comps=$( __get_all_sysdevs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; @@ -287,7 +307,7 @@ _udevadm() { if [[ $cur = -* ]]; then comps="${OPTS[COMMON]} ${OPTS[WAIT]}" else - comps=$( __get_all_devs ) + comps=$( __get_all_devices ) local IFS=$'\n' fi ;; |