diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2018-01-15 13:51:29 +0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-15 13:51:29 +0400 |
commit | c557fc3e2f3ac132da90c48aa365a902be65696e (patch) | |
tree | c8ca2e6247aae7e8f6b33740a6255ce03f27000e /shell-completion | |
parent | 67ddb52432dd4b16767e7d0531e4e0e3ae830acf (diff) | |
parent | 68c7139a4b78f5e3fb61d0c5b642a9260a89dd7a (diff) | |
download | systemd-c557fc3e2f3ac132da90c48aa365a902be65696e.tar.gz |
Merge pull request #7844 from yuwata/bash-completion
update bash completions
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/bootctl | 5 | ||||
-rw-r--r-- | shell-completion/bash/busctl | 7 | ||||
-rw-r--r-- | shell-completion/bash/coredumpctl | 11 | ||||
-rw-r--r-- | shell-completion/bash/hostnamectl | 2 | ||||
-rw-r--r-- | shell-completion/bash/journalctl | 18 | ||||
-rw-r--r-- | shell-completion/bash/kernel-install | 2 | ||||
-rw-r--r-- | shell-completion/bash/localectl | 13 | ||||
-rw-r--r-- | shell-completion/bash/loginctl | 11 | ||||
-rw-r--r-- | shell-completion/bash/machinectl | 19 | ||||
-rw-r--r-- | shell-completion/bash/networkctl | 4 | ||||
-rw-r--r-- | shell-completion/bash/systemctl.in | 14 | ||||
-rw-r--r-- | shell-completion/bash/systemd-analyze | 9 | ||||
-rw-r--r-- | shell-completion/bash/systemd-cgls | 16 | ||||
-rw-r--r-- | shell-completion/bash/systemd-detect-virt | 3 | ||||
-rw-r--r-- | shell-completion/bash/systemd-nspawn | 27 | ||||
-rw-r--r-- | shell-completion/bash/systemd-resolve | 20 | ||||
-rw-r--r-- | shell-completion/bash/systemd-run | 7 | ||||
-rw-r--r-- | shell-completion/bash/timedatectl | 14 |
18 files changed, 136 insertions, 66 deletions
diff --git a/shell-completion/bash/bootctl b/shell-completion/bash/bootctl index 34b1b552d9..9d7b51bcec 100644 --- a/shell-completion/bash/bootctl +++ b/shell-completion/bash/bootctl @@ -29,7 +29,8 @@ _bootctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='-h --help --version' + [STANDALONE]='-h --help --no-variables -p --print-path --version' + [ARG]='--path' ) if [[ "$cur" = -* ]]; then @@ -38,7 +39,7 @@ _bootctl() { fi local -A VERBS=( - [STANDALONE]='status' + [STANDALONE]='help install list remove status update' ) for ((i=0; i < COMP_CWORD; i++)); do diff --git a/shell-completion/bash/busctl b/shell-completion/bash/busctl index aa4c1d74d9..d077675a32 100644 --- a/shell-completion/bash/busctl +++ b/shell-completion/bash/busctl @@ -78,9 +78,10 @@ _busctl() { local -A OPTS=( [STANDALONE]='-h --help --version --no-pager --no-legend --system --user --show-machine --unique --acquired --activatable --list - --quiet --verbose --expect-reply=no --auto-start=no - --allow-interactive-authorization=yes --augment-creds=no' - [ARG]='-H --host -M --machine --address --match --timeout' + -q --quiet --verbose --expect-reply=no --auto-start=no + --allow-interactive-authorization=no --augment-creds=no + --watch-bind=yes' + [ARG]='--address -H --host -M --machine --match --timeout --size' ) if __contains_word "--user" ${COMP_WORDS[*]}; then diff --git a/shell-completion/bash/coredumpctl b/shell-completion/bash/coredumpctl index 842e4943ff..bc069a7644 100644 --- a/shell-completion/bash/coredumpctl +++ b/shell-completion/bash/coredumpctl @@ -39,22 +39,25 @@ _coredumpctl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-pager --no-legend -o --output -F --field -1 - -r --reverse -S --since -U --until' + -r --reverse -S --since -U --until -D --directory -q --quiet' local -A VERBS=( - [LIST]='list' + [LIST]='list info' [DUMP]='dump gdb' ) if __contains_word "$prev" '--output -o'; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames - elif __contains_word "$prev" '--FIELD -F'; then + elif __contains_word "$prev" '-D --directory'; then + comps=$( compgen -A directory -- "$cur" ) + compopt -o filenames + elif __contains_word "$prev" '--field -F'; then comps=$( compgen -W '${__journal_fields[*]}' -- "$cur" ) elif [[ $cur = -* ]]; then comps=${OPTS} elif __contains_word "$prev" ${VERBS[*]} && - ! __contains_word ${COMP_WORDS[COMP_CWORD-2]} '--output -o -F --field'; then + ! __contains_word ${COMP_WORDS[COMP_CWORD-2]} '--output -o -D --directory -F --field'; then compopt -o nospace COMPREPLY=( $(compgen -W '${__journal_fields[*]}' -S= -- "$cur") ) return 0 diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index a35ac7f9a0..1b41603010 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -29,7 +29,7 @@ _hostnamectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --transient --static --pretty - --no-ask-password -H --host --machine' + --no-ask-password -H --host -M --machine' if [[ $cur = -* ]]; then COMPREPLY=( $(compgen -W '${OPTS[*]}' -- "$cur") ) diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 03ee733d7e..d2b9a04706 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -39,25 +39,25 @@ _journalctl() { [STANDALONE]='-a --all --full --system --user --disk-usage -f --follow --header -h --help -l --local --new-id128 -m --merge --no-pager - --no-tail -q --quiet --setup-keys --this-boot --verify + --no-tail -q --quiet --setup-keys --verify --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' - [ARG]='-b --boot --this-boot -D --directory --file -F --field + --flush --rotate --sync --no-hostname -N --fields' + [ARG]='-b --boot -D --directory --file -F --field -t --identifier -M --machine -o --output -u --unit --user-unit -p --priority - --vacuum-size --vacuum-time --vacuum-files' - [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until - --after-cursor --verify-key -t --identifier --root' + [ARGUNKNOWN]='-c --cursor --interval -n --lines -S --since -U --until + --after-cursor --verify-key + --vacuum-size --vacuum-time --vacuum-files --output-fields' ) if __contains_word "$prev" ${OPTS[ARG]} ${OPTS[ARGUNKNOWN]}; then case $prev in - --boot|--this-boot|-b) + --boot|-b) comps=$(journalctl -F '_BOOT_ID' 2>/dev/null) ;; - --directory|-D) + --directory|-D|--root) comps=$(compgen -d -- "$cur") compopt -o filenames ;; @@ -66,7 +66,7 @@ _journalctl() { compopt -o filenames ;; --output|-o) - comps='short short-full short-iso short-precise short-monotonic short-unix verbose export json json-pretty json-sse cat' + comps='short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json json-pretty json-sse cat' ;; --field|-F) comps=$(journalctl --fields | sort 2>/dev/null) diff --git a/shell-completion/bash/kernel-install b/shell-completion/bash/kernel-install index 5a78528d36..f291d3e63a 100644 --- a/shell-completion/bash/kernel-install +++ b/shell-completion/bash/kernel-install @@ -38,7 +38,7 @@ _kernel_install() { fi ;; 3) - [[ "$cur" ]] || cur=/boot/vmlinuz-${COMP_WORDS[2]} + [[ "$cur" ]] || cur=/lib/modules/${COMP_WORDS[2]}/vmlinuz comps=$(compgen -f -- "$cur") compopt -o filenames ;; diff --git a/shell-completion/bash/localectl b/shell-completion/bash/localectl index 97c91a4ce2..f02476f733 100644 --- a/shell-completion/bash/localectl +++ b/shell-completion/bash/localectl @@ -35,7 +35,7 @@ _localectl() { local i verb comps locale_vals local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --no-convert --no-pager --no-ask-password - -H --host --machine' + -H --host -M --machine' if __contains_word "$prev" $OPTS; then case $prev in @@ -53,10 +53,11 @@ _localectl() { fi local -A VERBS=( - [STANDALONE]='status list-locales list-keymaps' - [LOCALES]='set-locale' - [KEYMAPS]='set-keymap' - [X11]='set-x11-keymap' + [STANDALONE]='status list-locales list-keymaps list-x11-keymap-models list-x11-keymap-layouts list-x11-keymap-options' + [VARIANTS]='list-x11-keymap-variants' + [LOCALES]='set-locale' + [KEYMAPS]='set-keymap' + [X11]='set-x11-keymap' ) for ((i=0; i < COMP_CWORD; i++)); do @@ -68,6 +69,8 @@ _localectl() { if [[ -z $verb ]]; then comps=${VERBS[*]} + elif __contains_word "$verb" ${VERBS[VARIANTS]}; then + comps=$(command localectl list-x11-keymap-layouts) elif __contains_word "$verb" ${VERBS[LOCALES]}; then if [[ $cur = *=* ]]; then mapfile -t locale_vals < <(command localectl list-locales 2>/dev/null) diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl index d8d14f889a..f78139b266 100644 --- a/shell-completion/bash/loginctl +++ b/shell-completion/bash/loginctl @@ -34,10 +34,11 @@ _loginctl () { local i verb comps local -A OPTS=( - [STANDALONE]='--all -a --help -h --no-pager --privileged -P --version - --no-legend --no-ask-password -l --full' - [ARG]='--host -H --kill-who --property -p --signal -s --machine' - ) + [STANDALONE]='--all -a --help -h --no-pager --version + --no-legend --no-ask-password -l --full --value' + [ARG]='--host -H --kill-who --property -p --signal -s -M --machine + -n --lines -o --output' + ) if __contains_word "$prev" ${OPTS[ARG]}; then case $prev in @@ -69,7 +70,7 @@ _loginctl () { [SESSIONS]='session-status show-session activate lock-session unlock-session terminate-session kill-session' [USERS]='user-status show-user enable-linger disable-linger terminate-user kill-user' [SEATS]='seat-status show-seat terminate-seat' - [STANDALONE]='list-sessions list-users list-seats flush-devices' + [STANDALONE]='list-sessions lock-sessions unlock-sessions list-users list-seats flush-devices' [ATTACH]='attach' ) diff --git a/shell-completion/bash/machinectl b/shell-completion/bash/machinectl index 7865a99882..30cf9448e5 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -36,13 +36,17 @@ _machinectl() { local i verb comps local -A OPTS=( - [STANDALONE]='--all -a --full --help -h --no-ask-password --no-legend --no-pager --version' - [ARG]='--host -H --kill-who -M --machine --property -p --signal -s' + [STANDALONE]='--all -a -l --full --help -h --no-ask-password --no-legend --no-pager --version --value + --mkdir --read-only --force -q --quiet' + [ARG]='--host -H --kill-who -M --machine --property -p --signal -s --uid -E --setenv -n --lines + -o --output --verify --format --max-addresses' ) local -A VERBS=( - [STANDALONE]='list list-images pull-tar pull-raw import-tar import-raw export-tar export-raw list-transfers cancel-transfer' - [MACHINES]='status show start stop login shell enable disable poweroff reboot terminate kill copy-to copy-from image-status show-image clone rename read-only remove set-limit' + [STANDALONE]='list list-images clean pull-tar pull-raw list-transfers cancel-transfer' + [MACHINES]='status show start stop login shell enable disable poweroff reboot terminate kill bind copy-to copy-from + image-status show-image clone rename read-only remove set-limit export-tar export-raw' + [FILE]='import-tar import-raw' ) _init_completion || return @@ -73,6 +77,9 @@ _machinectl() { --property|-p) comps='' ;; + --output|-o) + comps='short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json json-pretty json-sse cat' + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 @@ -91,6 +98,10 @@ _machinectl() { elif __contains_word "$verb" ${VERBS[MACHINES]}; then comps=$( __get_machines ) + + elif __contains_word "$verb" ${VERBS[FILE]}; then + comps=$(compgen -f -- "cur") + compopt -o filenames fi COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/networkctl b/shell-completion/bash/networkctl index 0c36aaf464..fb92c675d2 100644 --- a/shell-completion/bash/networkctl +++ b/shell-completion/bash/networkctl @@ -37,8 +37,8 @@ _networkctl() { ) local -A VERBS=( - [STANDALONE]='list lldp label' - [LINKS]='status' + [STANDALONE]='label' + [LINKS]='status list lldp' ) _init_completion || return diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 5a353f7107..080deeaace 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -126,10 +126,10 @@ _systemctl () { local -A OPTS=( [STANDALONE]='--all -a --reverse --after --before --defaults --force -f --full -l --global --help -h --no-ask-password --no-block --no-legend --no-pager --no-reload --no-wall --now - --quiet -q --privileged -P --system --user --version --runtime --recursive -r --firmware-setup - --show-types -i --ignore-inhibitors --plain --failed' + --quiet -q --system --user --version --runtime --recursive -r --firmware-setup + --show-types -i --ignore-inhibitors --plain --failed --value --fail --dry-run --wait' [ARG]='--host -H --kill-who --property -p --signal -s --type -t --state --job-mode --root - --preset-mode -n --lines -o --output -M --machine' + --preset-mode -n --lines -o --output -M --machine --message' ) if __contains_word "--user" ${COMP_WORDS[*]}; then @@ -203,14 +203,15 @@ _systemctl () { [TARGET_AND_UNITS]='add-wants add-requires' [MASKED_UNITS]='unmask' [JOBS]='cancel' - [ENVS]='set-environment unset-environment' + [ENVS]='set-environment unset-environment import-environment' [STANDALONE]='daemon-reexec daemon-reload default emergency exit halt hibernate hybrid-sleep kexec list-jobs list-sockets list-timers list-units list-unit-files poweroff reboot rescue show-environment suspend get-default - is-system-running' + is-system-running preset-all' [FILE]='link switch-root' [TARGETS]='set-default' + [MACHINES]='list-machines' ) for ((i=0; i < COMP_CWORD; i++)); do @@ -294,12 +295,13 @@ _systemctl () { elif __contains_word "$verb" ${VERBS[ENVS]}; then comps=$( __systemctl $mode show-environment \ - | while read -r line; do echo " ${line%%=*}=";done ) + | while read -r line; do echo " ${line%%=*}="; done ) compopt -o nospace elif __contains_word "$verb" ${VERBS[FILE]}; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames + elif __contains_word "$verb" ${VERBS[TARGETS]}; then comps=$( __systemctl $mode list-unit-files --type target --full --all \ | { while read -r a b; do echo " $a"; done; } ) diff --git a/shell-completion/bash/systemd-analyze b/shell-completion/bash/systemd-analyze index 45ff7a1f3e..34d274bb4f 100644 --- a/shell-completion/bash/systemd-analyze +++ b/shell-completion/bash/systemd-analyze @@ -36,12 +36,13 @@ _systemd_analyze() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='--help --version --system --user --order --require --no-pager --man' - [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern ' + [STANDALONE]='-h --help --version --system --user --order --require --no-pager + --man=no --generators=yes' + [ARG]='-H --host -M --machine --fuzz --from-pattern --to-pattern' ) local -A VERBS=( - [STANDALONE]='time blame plot dump get-log-level get-log-target' + [STANDALONE]='time blame plot dump get-log-level get-log-target calendar' [CRITICAL_CHAIN]='critical-chain' [DOT]='dot' [LOG_LEVEL]='set-log-level' @@ -117,7 +118,7 @@ _systemd_analyze() { elif __contains_word "$verb" ${VERBS[VERIFY]}; then if [[ $cur = -* ]]; then - comps='--help --version --system --user --man' + comps='--help --version --system --user --man=no --generators=yes' else comps=$( compgen -A file -- "$cur" ) compopt -o filenames diff --git a/shell-completion/bash/systemd-cgls b/shell-completion/bash/systemd-cgls index 0f579a6e67..34c7b9e67f 100644 --- a/shell-completion/bash/systemd-cgls +++ b/shell-completion/bash/systemd-cgls @@ -30,13 +30,21 @@ __get_machines() { machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; } +__get_units_have_cgroup() { + systemctl $1 list-units | { + while read -r a b c d; do + [[ $c == "active" && ${a##*.} =~ (service|socket|mount|swap|slice|scope) ]] && echo " $a" + done + }; +} + _systemd_cgls() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps local -A OPTS=( [STANDALONE]='-h --help --version --all -l --full -k --no-pager' - [ARG]='-M --machine' + [ARG]='-M --machine -u --unit --user-unit' ) _init_completion || return @@ -46,6 +54,12 @@ _systemd_cgls() { --machine|-M) comps=$( __get_machines ) ;; + --unit|-u) + comps=$( __get_units_have_cgroup --system ) + ;; + --user-unit) + comps=$( __get_units_have_cgroup --user ) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-detect-virt b/shell-completion/bash/systemd-detect-virt index 21dca2b966..5fab7cb12e 100644 --- a/shell-completion/bash/systemd-detect-virt +++ b/shell-completion/bash/systemd-detect-virt @@ -30,7 +30,8 @@ _systemd_detect_virt() { local i verb comps local -A OPTS=( - [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet' + [STANDALONE]='-h --help --version -c --container -v --vm -q --quiet + --private-users' ) _init_completion || return diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index 4f2fbef84f..660972d9f1 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -57,12 +57,13 @@ _systemd_nspawn() { local i verb comps local -A OPTS=( - [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit --network-veth -j' - [ARG]='-D --directory -u --user --uuid --capability --drop-capability --link-journal --bind --bind-ro -M --machine - -S --slice --setenv -Z --selinux-context -L --selinux-apifs-context --register --network-interface --network-bridge - --personality -i --image --tmpfs --volatile - --network-macvlan --kill-signal --template - --notify-ready' + [STANDALONE]='-h --help --version --private-network -b --boot --read-only -q --quiet --share-system --keep-unit -n --network-veth + -j -x --ephemeral -a --as-pid2 --private-users-chown -U' + [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 --volatile --network-macvlan --kill-signal --template --notify-ready --root-hash + --chdir --pivot-root --property --private-users --network-namespace-path --network-ipvlan --network-veth-extra + --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings' ) _init_completion || return @@ -76,7 +77,7 @@ _systemd_nspawn() { --user|-u) comps=$( __get_users ) ;; - --uuid) + --uuid|--root-hash) comps='' ;; --capability) @@ -106,7 +107,7 @@ _systemd_nspawn() { --slice|-S) comps=$( __get_slices ) ;; - --setenv) + --setenv|-E) comps=$( __get_env ) ;; --selinux-context|-Z) @@ -143,7 +144,15 @@ _systemd_nspawn() { ;; --notify-ready) comps='yes no' - return + ;; + --private-users) + comps='yes no pick' + ;; + --network-namespace-path) + comps=$( compgen -A file -- "$cur" ) + ;; + --settings) + comps='yes no override trusted' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/systemd-resolve b/shell-completion/bash/systemd-resolve index 3f789e80d0..ecd1ebad54 100644 --- a/shell-completion/bash/systemd-resolve +++ b/shell-completion/bash/systemd-resolve @@ -36,11 +36,13 @@ _systemd-resolve() { local i comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local -A OPTS=( - [STANDALONE]='-h --help --version -4 -6 + [STANDALONE]='-h --help --version --no-pager -4 -6 --service --openpgp --tlsa --status --statistics --reset-statistics --service-address=no --service-txt=no - --cname=no --search=no --legend=no' - [ARG]='-i --interface -p --protocol -t --type -c --class' + --cname=no --search=no --legend=no --flush-caches + --reset-server-features --revert' + [ARG]='-i --interface -p --protocol -t --type -c --class --raw + --set-dns --set-domain --set-llmnr --set-mdns --set-dnssec --set-nta' ) if __contains_word "$prev" ${OPTS[ARG]}; then @@ -51,6 +53,18 @@ _systemd-resolve() { --protocol|-p|--type|-t|--class|-c) comps=$( systemd-resolve --legend=no "$prev" help; echo help ) ;; + --raw) + comps="payload packet" + ;; + --set-dns|--set-domain|--set-nta) + comps="" + ;; + --set-llmnr|--set-mdns) + comps="yes no resolve" + ;; + --set-dnssec) + comps="yes no allow-downgrade" + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index 125cd306f0..b9114fc1b5 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -36,15 +36,16 @@ _systemd_run() { local OPTS='-h --help --version --user --system --scope --unit --description --slice -r --remain-after-exit --send-sighup -H --host -M --machine --service-type --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 - --wait' + --on-calendar --timer-property --path-property --socket-property -t --pty + -q --quiet --no-block --uid --gid --nice -E --setenv -p --property + --no-ask-password --wait -P --pipe -G --collect' 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 + --path-property --socket-property --uid --gid --nice -E --setenv ) for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then diff --git a/shell-completion/bash/timedatectl b/shell-completion/bash/timedatectl index b9d00811e3..13b99f22ba 100644 --- a/shell-completion/bash/timedatectl +++ b/shell-completion/bash/timedatectl @@ -25,16 +25,24 @@ __contains_word () { done } +__get_machines() { + local a b + machinectl list --no-legend --no-pager | { while read a b; do echo " $a"; done; }; +} + _timedatectl() { local i verb comps local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local OPTS='-h --help --version --adjust-system-clock --no-pager - --no-ask-password -H --host --machine' + --no-ask-password -H --host -M --machine' if __contains_word "$prev" $OPTS; then case $prev in --host|-H) - comps='' + comps=$(compgen -A hostname) + ;; + --machine|-M) + comps=$( __get_machines ) ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) @@ -48,7 +56,7 @@ _timedatectl() { local -A VERBS=( [BOOLEAN]='set-local-rtc set-ntp' - [STANDALONE]='status set-time list-timezones' + [STANDALONE]='status list-timezones' [TIMEZONES]='set-timezone' [TIME]='set-time' ) |