diff options
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/journalctl | 13 | ||||
-rw-r--r-- | shell-completion/bash/machinectl | 7 | ||||
-rw-r--r-- | shell-completion/bash/networkctl | 70 | ||||
-rw-r--r-- | shell-completion/bash/systemctl.in | 28 | ||||
-rw-r--r-- | shell-completion/bash/systemd-analyze | 6 | ||||
-rw-r--r-- | shell-completion/bash/systemd-cgtop | 25 | ||||
-rw-r--r-- | shell-completion/bash/systemd-nspawn | 2 | ||||
-rw-r--r-- | shell-completion/bash/systemd-path | 60 | ||||
-rw-r--r-- | shell-completion/bash/systemd-run | 21 | ||||
-rw-r--r-- | shell-completion/zsh/_busctl | 15 | ||||
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 4 | ||||
-rw-r--r-- | shell-completion/zsh/_udevadm | 2 |
12 files changed, 225 insertions, 28 deletions
diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 1387524a85..056cdbce70 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -27,8 +27,8 @@ __contains_word () { __journal_fields=(MESSAGE{,_ID} PRIORITY CODE_{FILE,LINE,FUNC} ERRNO SYSLOG_{FACILITY,IDENTIFIER,PID} COREDUMP_EXE _{P,U,G}ID _COMM _EXE _CMDLINE - _AUDIT_{SESSION,LOGINUID} - _SYSTEMD_{CGROUP,SESSION,UNIT,OWNER_UID} + _CAP_EFFECTIVE _AUDIT_{SESSION,LOGINUID} + _SYSTEMD_{CGROUP,SESSION,{,USER_}UNIT,OWNER_UID,SLICE} _SELINUX_CONTEXT _SOURCE_REALTIME_TIMESTAMP _{BOOT,MACHINE}_ID _HOSTNAME _TRANSPORT _KERNEL_{DEVICE,SUBSYSTEM} @@ -47,12 +47,13 @@ _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' + --flush --rotate' [ARG]='-b --boot --this-boot -D --directory --file -F --field - -o --output -u --unit --user-unit -p --priority' + -o --output -u --unit --user-unit -p --priority + --vacuum-size --vacuum-time' [ARGUNKNOWN]='-c --cursor --interval -n --lines --since --until - --after-cursor --verify-key --identifier - --root --machine' + --after-cursor --verify-key -t --identifier + --root -M --machine' ) if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl index 3789492d72..140465d316 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -26,7 +26,8 @@ __contains_word() { __get_machines() { local a b - machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; + (machinectl list-images --no-legend --no-pager; machinectl list --no-legend --no-pager; echo ".host") | \ + { while read a b; do echo " $a"; done; } | sort -u; } _machinectl() { @@ -39,8 +40,8 @@ _machinectl() { ) local -A VERBS=( - [STANDALONE]='list' - [MACHINES]='status show terminate kill reboot login' + [STANDALONE]='list list-images pull-tar pull-raw pull-dkr import-tar import-raw export-tar export-raw list-transfers cancel-transfer' + [MACHINES]='status show start login shell enable disable poweroff reboot terminate kill copy-to copy-from image-status show-image clone rename read-only remove set-limit' ) _init_completion || return diff --git a/shell-completion/bash/networkctl b/shell-completion/bash/networkctl new file mode 100644 index 0000000000..942c7e1c00 --- /dev/null +++ b/shell-completion/bash/networkctl @@ -0,0 +1,70 @@ +# networkctl(1) completion -*- shell-script -*- +# +# 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 <http://www.gnu.org/licenses/>. + +__contains_word () { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +__get_links() { + networkctl list --no-legend --no-pager --all | { while read -r a b c; do echo " $b"; done; }; +} + +_networkctl() { + local i verb comps + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} + local -A OPTS=( + [STANDALONE]='-a --all -h --help --version --no-pager --no-legend' + [ARG]='' + ) + + local -A VERBS=( + [STANDALONE]='list lldp' + [LINKS]='status' + ) + + _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 [[ "$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[LINKS]}; then + comps=$( __get_links ) + fi + + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 +} + +complete -F _networkctl networkctl diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index c2707ba3a6..29bb41c436 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -85,6 +85,12 @@ __get_masked_units () { __systemctl $1 list-unit-files \ | { while read -r a b c ; do [[ $b == "masked" ]] && echo " $a"; done; }; } __get_all_unit_files () { { __systemctl $1 list-unit-files; } | { while read -r a b; do echo " $a"; done; }; } +__get_machines() { + local a b + { machinectl list-images --no-legend --no-pager; machinectl list --no-legend --no-pager; } | \ + { while read a b; do echo " $a"; done; } +} + _systemctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps mode @@ -92,8 +98,10 @@ _systemctl () { local -A OPTS=( [STANDALONE]='--all -a --reverse --after --before --defaults --failed --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall - --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup' - [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root' + --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup + --show-types -i --ignore-inhibitors --plain' + [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root + --preset-mode -n --lines -o --output -M --machine' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -108,12 +116,10 @@ _systemctl () { comps=$(compgen -A signal) ;; --type|-t) - comps='automount busname device mount path service snapshot socket swap target timer' + comps=$(__systemctl $mode -t help) ;; --state) - comps='loaded not-found stub - active inactive - dead elapsed exited listening mounted plugged running waiting' + comps=$(__systemctl $mode --state=help) ;; --job-mode) comps='fail replace replace-irreversibly isolate @@ -132,6 +138,16 @@ _systemctl () { --property|-p) comps=$(__systemd_properties $mode) ;; + --preset-mode) + comps='full enable-only disable-only' + ;; + --output|-o) + comps='short short-iso short-precise short-monotonic verbose export json + json-pretty json-sse cat' + ;; + --machine|-M) + comps=$( __get_machines ) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 00947029c6..7a5f46ba1d 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -35,8 +35,8 @@ _systemd_analyze() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='--help --version --system --user --from-pattern --to-pattern --order --require --no-pager' - [ARG]='-H --host -M --machine --fuzz --man' + [STANDALONE]='--help --version --system --user --order --require --no-pager --man' + [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern ' ) local -A VERBS=( @@ -102,7 +102,7 @@ _systemd_analyze() { elif __contains_word "$verb" ${VERBS[VERIFY]}; then if [[ $cur = -* ]]; then - comps='--help --version --system --user --no-man' + comps='--help --version --system --user --man' else comps=$( compgen -A file -- "$cur" ) compopt -o filenames diff --git a/shell-completion/bash/systemd-cgtop b/shell-completion/bash/systemd-cgtop index 50464990ab..f1ed22fd55 100644 --- a/shell-completion/bash/systemd-cgtop +++ b/shell-completion/bash/systemd-cgtop @@ -24,17 +24,38 @@ __contains_word() { done } +__get_machines() { + local a b + machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; +} + _systemd_cgtop() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local comps local -A OPTS=( - [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -n --iterations -d --delay' - [ARG]='--cpu --depth' + [STANDALONE]='-h --help --version -p -t -c -m -i -b --batch -r --raw -k -P' + [ARG]='--cpu --depth -M --machine --recursive -n --iterations -d --delay --order' ) _init_completion || return + if __contains_word "$prev" ${OPTS[ARG]}; then + case $prev in + --machine|-M) + comps=$( __get_machines ) + ;; + --recursive) + comps='yes no' + ;; + --order) + comps='path tasks cpu memory io' + ;; + esac + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) } diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index 83e34ef02e..f9b740380c 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -85,7 +85,7 @@ _systemd_nspawn() { CAP_SYS_CHROOT CAP_SYS_NICE CAP_SYS_PTRACE CAP_SYS_RESOURCE CAP_SYS_TTY_CONFIG' ;; --link-journal) - comps='no auto guest host' + comps='no auto guest try-guest host try-host' ;; --bind|--bind-ro) compopt -o nospace diff --git a/shell-completion/bash/systemd-path b/shell-completion/bash/systemd-path new file mode 100644 index 0000000000..2f0c5f5bd7 --- /dev/null +++ b/shell-completion/bash/systemd-path @@ -0,0 +1,60 @@ +# systemd-path(1) completion -*- shell-script -*- +# +# 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 <http://www.gnu.org/licenses/>. + +__contains_word () { + local w word=$1; shift + for w in "$@"; do + [[ $w = "$word" ]] && return + done + return 1 +} + +__get_names() { + systemd-path | { while IFS=: read -r a b; do echo " $a"; done; } +} + +_systemd_path() { + local comps + local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} + local -A OPTS=( + [STANDALONE]='-h --help --version' + [ARG]='--suffix' + ) + + _init_completion || return + + if __contains_word "$prev" ${OPTS[ARG]}; then + case $prev in + --suffix) + comps='' + ;; + esac + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + fi + + if [[ "$cur" = -* ]]; then + COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) + return 0 + fi + + comps=$( __get_names ) + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 +} + +complete -F _systemd_path systemd-path diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index 712655caf4..b1387a28b6 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -34,10 +34,16 @@ _systemd_run() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --user --system --scope --unit --description --slice -r --remain-after-exit --send-sighup -H --host -M --machine --service-type - --uid --gid --nice --setenv -p --property' + --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive + --on-calendar --timer-property -t --pty -q --quiet --no-block + --uid --gid --nice --setenv -p --property --no-ask-password' local mode=--system local i + local opts_with_values=( + --unit --description --slice --service-type -H --host -M --machine -p --property --on-active + --on-boot --on-startup --on-unit-active --on-unit-inactive --on-calendar --timer-property + ) for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then local root_command=${COMP_WORDS[i]} @@ -47,11 +53,11 @@ _systemd_run() { [[ ${COMP_WORDS[i]} == "--user" ]] && mode=--user - [[ $i -lt $COMP_CWORD && ${COMP_WORDS[i]} == @(--unit|--description|--slice|--service-type|-H|--host|-M|--machine|-p|--property) ]] && ((i++)) + [[ $i -lt $COMP_CWORD && " ${opts_with_values[@]} " =~ " ${COMP_WORDS[i]} " ]] && ((i++)) done case "$prev" in - --unit|--description) + --unit|--description|--on-active|--on-boot|--on-startup|--on-unit-active|--on-unit-inactive|--on-calendar) # argument required but no completions available return ;; @@ -75,7 +81,9 @@ _systemd_run() { KillSignal= LimitCPU= LimitFSIZE= LimitDATA= LimitSTACK= LimitCORE= LimitRSS= LimitNOFILE= LimitAS= LimitNPROC= LimitMEMLOCK= LimitLOCKS= LimitSIGPENDING= LimitMSGQUEUE= - LimitNICE= LimitRTPRIO= LimitRTTIME=' + LimitNICE= LimitRTPRIO= LimitRTTIME= PrivateTmp= PrivateDevices= + PrivateNetwork= NoNewPrivileges= WorkingDirectory= RootDirectory= + TTYPath= SyslogIdentifier= SyslogLevelPrefix=' COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 @@ -92,6 +100,11 @@ _systemd_run() { COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; + --timer-property) + local comps='AccuracySec= WakeSystem=' + COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) + return 0 + ;; esac COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) diff --git a/shell-completion/zsh/_busctl b/shell-completion/zsh/_busctl index fb1841341e..ef790e558f 100644 --- a/shell-completion/zsh/_busctl +++ b/shell-completion/zsh/_busctl @@ -24,7 +24,14 @@ local -a _busctl_cmds _busctl_cmds=( "list:List bus names" + "status:Show bus service, process or bus owner credentials" "monitor:Show bus traffic" + "capture:Capture bus traffix as pcap" + "tree:Show object tree of service" + "introspect:Introspect object" + "call:Call a method" + "get-property:Get property value" + "set-property:Set property value" ) if (( CURRENT == 1 )); then _describe -t commands 'busctl command' _busctl_cmds || compadd "$@" @@ -54,4 +61,12 @@ _arguments \ '--acquired[Only show acquired names]' \ '--activatable[Only show activatable names]' \ '--match=[Only show matching messages]:match' \ + '--list[Do not show tree, but simple object path list]' \ + '--quiet[Do not show method call reply]'\ + '--verbose[Show result values in long format]' \ + '--expect-reply=[Expect a method call reply]:boolean:(1 0)' \ + '--auto-start=[Auto-start destination service]:boolean:(1 0)' \ + '--allow-interactive-authorization=[Allow interactive authorization for operation]:boolean:(1 0)' \ + '--timeout=[Maximum time to wait for method call completion]:timeout (seconds)' \ + '--augment-creds=[Extend credential data with data read from /proc/$PID]:boolean:(1 0)' \ '*::busctl command:_busctl_command' diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 4bf306aacb..96f51a0ee0 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -334,13 +334,13 @@ _systemctl_caching_policy() _unit_states() { local -a _states - _states=(loaded failed active inactive not-found listening running waiting plugged mounted exited dead masked) + _states=("${(fo)$(__systemctl --state=help)}") _values -s , "${_states[@]}" } _unit_types() { local -a _types - _types=(automount busname device mount path service snapshot socket swap target timer) + _types=("${(fo)$(__systemctl -t help)}") _values -s , "${_types[@]}" } diff --git a/shell-completion/zsh/_udevadm b/shell-completion/zsh/_udevadm index e5d252c818..bb23e64d24 100644 --- a/shell-completion/zsh/_udevadm +++ b/shell-completion/zsh/_udevadm @@ -89,7 +89,7 @@ _udevadm_test-builtin(){ _udevadm_mounts(){ local dev_tmp dpath_tmp mp_tmp mline - tmp=( "${(@f)$(< /etc/mtab)}" ) + tmp=( "${(@f)$(< /proc/self/mounts)}" ) dev_tmp=( "${(@)${(@)tmp%% *}:#none}" ) mp_tmp=( "${(@)${(@)tmp#* }%% *}" ) |