diff --git a/shell-completion/bash/journalctl b/shell-completion/bash/journalctl index 829cf415be..bcd4533a63 100644 --- a/shell-completion/bash/journalctl +++ b/shell-completion/bash/journalctl @@ -38,7 +38,7 @@ _journalctl() { local -A OPTS=( [STANDALONE]='-a --all --full --system --user --disk-usage -f --follow --header - -h --help -l --local --new-id128 -m --merge --no-pager + -h --help -l --local -m --merge --no-pager --no-tail -q --quiet --setup-keys --verify --version --list-catalog --update-catalog --list-boots --show-cursor --dmesg -k --pager-end -e -r --reverse @@ -66,7 +66,7 @@ _journalctl() { compopt -o filenames ;; --output|-o) - comps='short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json json-pretty json-sse json-seq cat with-unit' + comps=$( journalctl --output=help 2>/dev/null ) ;; --field|-F) comps=$(journalctl --fields | sort 2>/dev/null) diff --git a/shell-completion/bash/loginctl b/shell-completion/bash/loginctl index 1f5b46620c..a0d224e9e2 100644 --- a/shell-completion/bash/loginctl +++ b/shell-completion/bash/loginctl @@ -29,6 +29,12 @@ __get_all_sessions () { loginctl --no-legend list-sessions | { while read -r a b __get_all_users () { loginctl --no-legend list-users | { while read -r a b; do printf "%s\n" "$b"; done; } ; } __get_all_seats () { loginctl --no-legend list-seats | { while read -r a b; do printf "%s\n" "$a"; done; } ; } +__get_machines() { + local a b + machinectl list --no-legend --no-pager 2>/dev/null | + { while read a b; do echo " $a"; done; }; +} + _loginctl () { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps @@ -52,9 +58,15 @@ _loginctl () { --host|-H) comps=$(compgen -A hostname) ;; + --machine|-M) + comps=$( __get_machines ) + ;; --property|-p) comps='' ;; + --output|-o) + comps=$( loginctl --output=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 16d037a000..802a262603 100644 --- a/shell-completion/bash/machinectl +++ b/shell-completion/bash/machinectl @@ -42,7 +42,7 @@ _machinectl() { ) local -A VERBS=( - [STANDALONE]='list list-images clean pull-tar pull-raw list-transfers cancel-transfer' + [STANDALONE]='list list-images clean pull-tar pull-raw list-transfers cancel-transfer import-fs' [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' @@ -77,7 +77,13 @@ _machinectl() { 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 json-seq cat with-unit' + comps=$( machinectl --output=help 2>/dev/null ) + ;; + --verify) + comps=$( machinectl --verify=help 2>/dev/null ) + ;; + --format) + comps='uncompressed xz gzip bzip2' ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index 8756bfb8a5..0e58e2ba4c 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -168,8 +168,7 @@ _systemctl () { comps='full enable-only disable-only' ;; --output|-o) - comps='short short-full short-iso short-iso-precise short-precise short-monotonic short-unix verbose export json - json-pretty json-sse json-seq cat with-unit' + comps=$( systemctl --output=help 2>/dev/null ) ;; --machine|-M) comps=$( __get_machines ) diff --git a/shell-completion/bash/systemd-nspawn b/shell-completion/bash/systemd-nspawn index 2ff39b65d7..62bb0ba605 100644 --- a/shell-completion/bash/systemd-nspawn +++ b/shell-completion/bash/systemd-nspawn @@ -44,13 +44,20 @@ __get_env() { env | { while read a; do echo " ${a%%=*}"; done; }; } -__get_interfaces(){ +__get_interfaces() { { cd /sys/class/net && echo *; } | \ while read -d' ' -r name; do [[ "$name" != "lo" ]] && echo "$name" done } +__get_rlimit() { + local i + for i in $(systemd-nspawn --rlimit=help 2>/dev/null); do + echo " ${i}=" + done +} + _systemd_nspawn() { local cur=${COMP_WORDS[COMP_CWORD]} prev=${COMP_WORDS[COMP_CWORD-1]} local i verb comps @@ -62,7 +69,8 @@ _systemd_nspawn() { -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' + --network-zone -p --port --system-call-filter --overlay --overlay-ro --settings + --rlimit --hostname --no-new-privileges --oom-score-adjust --cpu-affinity --resolv-conf --timezone' ) _init_completion || return @@ -131,7 +139,7 @@ _systemd_nspawn() { comps='x86 x86-64' ;; --volatile) - comps='yes state no' + comps=$( systemd-nspawn --volatile=help 2>/dev/null ) ;; --image|-i) compopt -o nospace @@ -153,6 +161,27 @@ _systemd_nspawn() { --settings) comps='yes no override trusted' ;; + --rlimit) + comps=$( __get_rlimit ) + ;; + --hostname) + comps='' + ;; + --no-new-privileges) + comps='yes no' + ;; + --oom-score-adjust) + comps='' + ;; + --cpu-affinity) + comps='' + ;; + --resolv-conf) + comps=$( systemd-nspawn --resolv-conf=help 2>/dev/null ) + ;; + --timezone) + comps=$( systemd-nspawn --timezone=help 2>/dev/null ) + ;; esac COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 diff --git a/shell-completion/bash/systemd-run b/shell-completion/bash/systemd-run index 4c60130dfa..0908bd9334 100644 --- a/shell-completion/bash/systemd-run +++ b/shell-completion/bash/systemd-run @@ -36,14 +36,15 @@ _systemd_run() { --on-active --on-boot --on-startup --on-unit-active --on-unit-inactive --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' + --no-ask-password --wait -P --pipe -G --collect --working-directory + -d --same-dir -S --shell' 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 + --path-property --socket-property --uid --gid --nice -E --setenv --working-directory ) for (( i=1; i <= COMP_CWORD; i++ )); do if [[ ${COMP_WORDS[i]} != -* ]]; then @@ -109,6 +110,17 @@ _systemd_run() { COMPREPLY=( $(compgen -W '$comps' -- "$cur") ) return 0 ;; + --working-directory) + 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") )