diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-01-05 12:34:28 +0100 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2021-01-08 20:01:40 +0100 |
commit | 341992081b6ece1adba270e239f96c9840884885 (patch) | |
tree | 1ef24c942104dd537a56b7484fc6794d49268e0e | |
parent | 32854f70447db074635d33abc9d94756072d63b4 (diff) | |
download | systemd-341992081b6ece1adba270e239f96c9840884885.tar.gz |
shell-completion: fix systemctl set/unset/import-environment
unset-environment is completed with variable names in the environment block.
set-environment the same, but suffixed with "=".
import-environment is completed with variable names in the client environment.
-rw-r--r-- | shell-completion/bash/systemctl.in | 11 | ||||
-rw-r--r-- | shell-completion/zsh/_systemctl.in | 5 |
2 files changed, 15 insertions, 1 deletions
diff --git a/shell-completion/bash/systemctl.in b/shell-completion/bash/systemctl.in index f6be3827cf..b26381a324 100644 --- a/shell-completion/bash/systemctl.in +++ b/shell-completion/bash/systemctl.in @@ -320,11 +320,20 @@ _systemctl () { elif __contains_word "$verb" ${VERBS[JOBS]}; then comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } ) - elif __contains_word "$verb" ${VERBS[ENVS]}; then + elif [ "$verb" = 'unset-environment' ]; then + comps=$( __systemctl $mode show-environment \ + | while read -r line; do echo " ${line%%=*}"; done ) + compopt -o nospace + + elif [ "$verb" = 'set-environment' ]; then comps=$( __systemctl $mode show-environment \ | while read -r line; do echo " ${line%%=*}="; done ) compopt -o nospace + elif [ "$verb" = 'import-environment' ]; then + COMPREPLY=( $(compgen -A variable -- "$cur_orig") ) + return 0 + elif __contains_word "$verb" ${VERBS[FILE]}; then comps=$( compgen -A file -- "$cur" ) compopt -o filenames diff --git a/shell-completion/zsh/_systemctl.in b/shell-completion/zsh/_systemctl.in index 4830aeba5f..22c40898e3 100644 --- a/shell-completion/zsh/_systemctl.in +++ b/shell-completion/zsh/_systemctl.in @@ -365,6 +365,11 @@ for fun in set-environment unset-environment ; do } done +(( $+functions[_systemctl_import-environment] )) || _systemctl_import-environment() +{ + _parameters +} + (( $+functions[_systemctl_link] )) || _systemctl_link() { _sd_unit_files } |