diff options
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/systemd-creds | 4 | ||||
-rw-r--r-- | shell-completion/bash/systemd-nspawn | 2 | ||||
-rw-r--r-- | shell-completion/bash/systemd-run | 7 | ||||
-rw-r--r-- | shell-completion/bash/udevadm | 97 | ||||
-rw-r--r-- | shell-completion/zsh/_systemd-run | 8 | ||||
-rw-r--r-- | shell-completion/zsh/_udevadm | 16 |
6 files changed, 111 insertions, 23 deletions
diff --git a/shell-completion/bash/systemd-creds b/shell-completion/bash/systemd-creds index c16619e94f..3142954625 100644 --- a/shell-completion/bash/systemd-creds +++ b/shell-completion/bash/systemd-creds @@ -41,7 +41,7 @@ _systemd_creds() { local verb comps mode i local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} words cword local -A OPTS=( - [STANDALONE]='-h --help --version --no-pager --no-legend + [STANDALONE]='-h --help --version --no-pager --no-legend --no-ask-password -H -T --system --user -p --pretty --allow-null' [ARG]='--tpm2-device --tpm2-device-key @@ -77,6 +77,7 @@ _systemd_creds() { --version --no-pager --no-legend + --no-ask-password --uid --with-key -H @@ -94,6 +95,7 @@ _systemd_creds() { --version --no-pager --no-legend + --no-ask-password --uid --tpm2-device --tpm2-pcrs diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index 0a1761d110..e1829287f4 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -157,7 +157,7 @@ _systemd_nspawn() { comps='yes no' ;; --private-users) - comps='yes no pick' + comps='yes no pick identity managed' ;; --network-namespace-path) comps=$( compgen -A file -- "$cur" ) diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index 4537211ae5..4524744bb5 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -38,7 +38,7 @@ _systemd_run() { --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 --expand-environment - --background --json + --background --json --job-mode ) 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 @@ -131,6 +131,11 @@ _systemd_run() { COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; + --job-mode) + local comps=$( systemd-run --job-mode=help 2>/dev/null ) + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; esac COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) diff --git a/shell-completion/bash/udevadm b/shell-completion/bash/udevadm index e5626c9301..02a025ff45 100644 --- a/shell-completion/bash/udevadm +++ b/shell-completion/bash/udevadm @@ -46,6 +46,35 @@ __get_all_devices() { __get_all_device_units } +__get_root() { + local i + + for ((i=0; i < COMP_CWORD; i++)); do + if [[ "${COMP_WORDS[i]}" = --root=* ]]; then + echo "${COMP_WORDS[i]#--root=}" + break + fi + if (( i > 0 )) && [[ "${COMP_WORDS[i-1]}" == "--root" ]]; then + echo "${COMP_WORDS[i]}" + break + fi + done +} + +__get_udev_rules_files() { + local root=$( __get_root ) + + ls "$root"/usr/lib/udev/rules.d/*.rules \ + "$root"/usr/local/lib/udev/rules.d/*.rules \ + "$root"/run/udev/rules.d/*.rules \ + "$root"/etc/udev/rules.d/*.rules 2>/dev/null +} + +__get_udev_rules_names() { + local -a rules=( $( __get_udev_rules_files ) ) + printf '%s\n' "${rules[@]##*/}" +} + _udevadm() { local i verb comps builtin local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} @@ -66,18 +95,22 @@ _udevadm() { [SETTLE]='-t --timeout -E --exit-if-exists' [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' + [CONTROL_ARG]='-l --log-priority -p --property -m --children-max -t --timeout --trace' [MONITOR_STANDALONE]='-k --kernel -u --udev -p --property' [MONITOR_ARG]='-s --subsystem-match -t --tag-match' - [TEST]='-a --action -N --resolve-names' + [TEST_STANDALONE]='-v --verbose' + [TEST_ARG]='-a --action -N --resolve-names -D --extra-rules-dir' [TEST_BUILTIN]='-a --action' - [VERIFY]='-N --resolve-names --root --no-summary --no-style' + [VERIFY_STANDALONE]='--no-summary --no-style' + [VERIFY_ARG]='-N --resolve-names --root' + [CAT_STANDALONE]='--tldr --config' + [CAT_ARG]='--root' [WAIT]='-t --timeout --initialized=no --removed --settle' [LOCK]='-t --timeout -d --device -b --backing -p --print' ) - local verbs=(info trigger settle control monitor test-builtin test verify wait lock) - local builtins=(blkid btrfs hwdb input_id keyboard kmod net_id net_setup_link path_id usb_id uaccess) + local verbs=(info trigger settle control monitor test-builtin test verify cat wait lock) + local builtins=(blkid btrfs hwdb input_id keyboard kmod net_driver net_id net_setup_link path_id uaccess usb_id) for ((i=0; i < COMP_CWORD; i++)); do if __contains_word "${COMP_WORDS[i]}" "${verbs[@]}"; then @@ -190,6 +223,9 @@ _udevadm() { -l|--log-priority) comps='alert crit debug emerg err info notice warning' ;; + --trace) + comps='yes no' + ;; *) comps='' ;; @@ -216,7 +252,7 @@ _udevadm() { ;; 'test') - if __contains_word "$prev" ${OPTS[TEST]}; then + if __contains_word "$prev" ${OPTS[TEST_ARG]}; then case $prev in -a|--action) comps=$( udevadm test --action help ) @@ -224,13 +260,12 @@ _udevadm() { -N|--resolve-names) comps='early late never' ;; + -D|--extra-rules-dir) + comps='' + compopt -o dirnames esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 - fi - - if [[ $cur = -* ]]; then - comps="${OPTS[COMMON]} ${OPTS[TEST]}" + elif [[ $cur = -* ]]; then + comps="${OPTS[COMMON]} ${OPTS[TEST_ARG]} ${OPTS[TEST_STANDALONE]}" else comps=$( __get_all_devices ) local IFS=$'\n' @@ -266,27 +301,51 @@ _udevadm() { ;; 'verify') - if __contains_word "$prev" ${OPTS[VERIFY]}; then + if __contains_word "$prev" ${OPTS[VERIFY_ARG]}; then case $prev in -N|--resolve-names) comps='early never' ;; --root) - comps=$(compgen -A directory -- "$cur" ) + comps='' compopt -o dirnames ;; *) comps='' ;; esac - COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) - return 0 + elif [[ $cur = -* ]]; then + comps="${OPTS[COMMON]} ${OPTS[VERIFY_ARG]} ${OPTS[VERIFY_STANDALONE]}" + elif [[ $cur = */* ]]; then + comps=$( __get_udev_rules_files ) + compopt -o dirnames + else + comps=$( __get_udev_rules_names ) + compopt -o default fi + ;; - if [[ $cur = -* ]]; then - comps="${OPTS[COMMON]} ${OPTS[VERIFY]}" + 'cat') + if __contains_word "$prev" ${OPTS[CAT_ARG]}; then + case $prev in + --root) + comps='' + compopt -o dirnames + ;; + *) + comps='' + ;; + esac + elif [[ $cur = -* ]]; then + comps="${OPTS[COMMON]} ${OPTS[CAT_ARG]} ${OPTS[CAT_STANDALONE]}" + elif __contains_word "--config" ${COMP_WORDS[*]}; then + comps="${OPTS[COMMON]} ${OPTS[CAT_ARG]} ${OPTS[CAT_STANDALONE]}" + elif [[ $cur = */* ]]; then + comps=$( __get_udev_rules_files ) + compopt -o dirnames else - comps=$( compgen -A file -- "$cur" ) + comps=$( __get_udev_rules_names ) + compopt -o default fi ;; diff --git a/shell-completion/zsh/_systemd-run b/shell-completion/zsh/_systemd-run index 4bb864da21..9ee5897178 100644 --- a/shell-completion/zsh/_systemd-run +++ b/shell-completion/zsh/_systemd-run @@ -22,6 +22,13 @@ __systemctl() { _describe 'slices' _slices } +(( $+functions[_systemd-run_job_modes] )) || + _systemd-run_job_modes() { + local -a _modes + _modes=($( systemd-run --job-mode=help 2>/dev/null )) + _values "${_modes[@]}" + } + _arguments \ '(-G --collect)'{-G,--collect}'[Unload the transient unit after it completed]' \ '--description=[Description for unit]:description' \ @@ -60,6 +67,7 @@ _arguments \ '(-t --pty)'{-t,--pty}'[The service connects to the terminal]' \ '(-q --quiet)'{-q,--quiet}'[Suppresses additional informational output]' \ '--json=[Output as JSON]:JSON:(pretty short off)' \ + '--job-mode=[Specify how to deal with other jobs]:mode:_systemd-run_job_modes' \ '(-r --remain-after-exit)'{-r,--remain-after-exit}'[Leave service around until explicitly stopped]' \ '(-d --same-dir)'{-d,--same-dir}'[Run on the current working directory]' \ '--scope[Run this as scope rather than service]' \ diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm index 5f5761cbfa..7572b09f67 100644 --- a/shell-completion/zsh/_udevadm +++ b/shell-completion/zsh/_udevadm @@ -66,6 +66,7 @@ _udevadm_control(){ '(-R --reload)'{-R,--reload}'[Signal systemd-udevd to reload the rules files and other databases like the kernel module index.]' \ '(-p --property)'{-p,--property=}'[Set a global property for all events.]:KEY=VALUE' \ '(-m --children-max=)'{-m,--children-max=}'[Set the maximum number of events.]:N' \ + '--trace=[Enable/disable trace logging.]:BOOL' \ '(-t --timeout=)'{-t,--timeout=}'[The maximum number of seconds to wait for a reply from systemd-udevd.]:SECONDS' } @@ -88,6 +89,8 @@ _udevadm_test(){ '(-)'{-V,--version}'[Show package version]' \ '--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \ '--subsystem=[The subsystem string.]' \ + '(-D --extra-rules-dir=)'{-D,--extra-rules-dir=}'[Also load rules from the directory.]' \ + '(-v --verbose)'{-v,--verbose}'[Show verbose logs.]' \ '*::devpath:_files -P /sys/ -W /sys' } @@ -98,7 +101,7 @@ _udevadm_test-builtin(){ '(- *)'{-h,--help}'[Print help]' \ '(- *)'{-V,--version}'[Print version of the program]' \ '--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \ - '*::builtins:(blkid btrfs hwdb input_id net_id net_setup_link kmod path_id usb_id uaccess)' + '*::builtins:(blkid btrfs hwdb input_id net_driver net_id net_setup_link kmod path_id uaccess usb_id)' elif (( CURRENT == 3 )); then _arguments \ '--action=[The action string.]:actions:(add change remove move online offline bind unbind)' \ @@ -123,6 +126,17 @@ _udevadm_verify(){ '*::files:_files' } +(( $+functions[_udevadm_cat] )) || +_udevadm_cat(){ + _arguments \ + '(- *)'{-h,--help}'[Show help]' \ + '(- *)'{-V,--version}'[Show package version]' \ + '--root=[Operate on catalog hierarchy under specified directory]:directories:_directories' \ + --tldr'[Skip comments and empty lines.]' \ + --config'[Show udev.conf.]' \ + '*::files:_files' +} + (( $+functions[_udevadm_wait] )) || _udevadm_wait(){ _arguments \ |