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.
This commit is contained in:
parent
32854f7044
commit
341992081b
|
@ -320,11 +320,20 @@ _systemctl () {
|
||||||
elif __contains_word "$verb" ${VERBS[JOBS]}; then
|
elif __contains_word "$verb" ${VERBS[JOBS]}; then
|
||||||
comps=$( __systemctl $mode list-jobs | { while read -r a b; do echo " $a"; done; } )
|
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 \
|
comps=$( __systemctl $mode show-environment \
|
||||||
| while read -r line; do echo " ${line%%=*}="; done )
|
| while read -r line; do echo " ${line%%=*}="; done )
|
||||||
compopt -o nospace
|
compopt -o nospace
|
||||||
|
|
||||||
|
elif [ "$verb" = 'import-environment' ]; then
|
||||||
|
COMPREPLY=( $(compgen -A variable -- "$cur_orig") )
|
||||||
|
return 0
|
||||||
|
|
||||||
elif __contains_word "$verb" ${VERBS[FILE]}; then
|
elif __contains_word "$verb" ${VERBS[FILE]}; then
|
||||||
comps=$( compgen -A file -- "$cur" )
|
comps=$( compgen -A file -- "$cur" )
|
||||||
compopt -o filenames
|
compopt -o filenames
|
||||||
|
|
|
@ -365,6 +365,11 @@ for fun in set-environment unset-environment ; do
|
||||||
}
|
}
|
||||||
done
|
done
|
||||||
|
|
||||||
|
(( $+functions[_systemctl_import-environment] )) || _systemctl_import-environment()
|
||||||
|
{
|
||||||
|
_parameters
|
||||||
|
}
|
||||||
|
|
||||||
(( $+functions[_systemctl_link] )) || _systemctl_link() {
|
(( $+functions[_systemctl_link] )) || _systemctl_link() {
|
||||||
_sd_unit_files
|
_sd_unit_files
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue