diff options
Diffstat (limited to 'shell-completion')
-rw-r--r-- | shell-completion/bash/hostnamectl | 3 | ||||
-rw-r--r-- | shell-completion/zsh/_hostnamectl | 32 | ||||
-rw-r--r-- | shell-completion/zsh/_localectl | 4 |
3 files changed, 35 insertions, 4 deletions
diff --git a/shell-completion/bash/hostnamectl b/shell-completion/bash/hostnamectl index 9c75da9e7f..22f8f06b69 100644 --- a/shell-completion/bash/hostnamectl +++ b/shell-completion/bash/hostnamectl @@ -39,6 +39,7 @@ _hostnamectl() { [STANDALONE]='status' [ICONS]='set-icon-name' [NAME]='set-hostname' + [CHASSIS]='set-chassis' ) for ((i=0; i < COMP_CWORD; i++)); do @@ -50,6 +51,8 @@ _hostnamectl() { if [[ -z $verb ]]; then comps=${VERBS[*]} + elif __contains_word "$verb" ${VERBS[CHASSIS]}; then + comps='desktop laptop server tablet handset watch vm container' elif __contains_word "$verb" ${VERBS[STANDALONE]} ${VERBS[ICONS]} ${VERBS[NAME]}; then comps='' fi diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl index 7effa0489e..be8687609e 100644 --- a/shell-completion/zsh/_hostnamectl +++ b/shell-completion/zsh/_hostnamectl @@ -1,5 +1,30 @@ #compdef hostnamectl +_hostnamectl_set-hostname() { + if (( CURRENT <= 3 )); then + _message "new hostname" + else + _message "no more options" + fi +} + +_hostnamectl_set-icon-name() { + if (( CURRENT <= 3 )); then + _message "new icon name" + else + _message "no more options" + fi +} + +_hostnamectl_set-chassis() { + if (( CURRENT <= 3 )); then + _chassis=( desktop laptop server tablet handset watch vm container ) + _describe chassis _chassis + else + _message "no more options" + fi +} + _hostnamectl_command() { local -a _hostnamectl_cmds _hostnamectl_cmds=( @@ -14,8 +39,11 @@ _hostnamectl_command() { local curcontext="$curcontext" cmd="${${_hostnamectl_cmds[(r)$words[1]:*]%%:*}}" if (( $#cmd )); then - [[ $cmd == status ]] && msg="no options" || msg="options for $cmd" - _message "$msg" + if [[ $cmd == status ]]; then + _message "no options" + else + _hostnamectl_$cmd + fi else _message "unknown hostnamectl command: $words[1]" fi diff --git a/shell-completion/zsh/_localectl b/shell-completion/zsh/_localectl index 87432da1dc..d8af4d1863 100644 --- a/shell-completion/zsh/_localectl +++ b/shell-completion/zsh/_localectl @@ -22,8 +22,8 @@ _localectl_set-locale() { _localectl_set-keymap() { local -a _keymaps - _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} ) if (( CURRENT <= 3 )); then + _keymaps=( ${(f)"$(_call_program locales "$service" list-keymaps)"} ) _describe keymaps _keymaps else _message "no more options" @@ -77,7 +77,7 @@ _localectl_command() { if (( $+functions[_localectl_$cmd] )); then _localectl_$cmd else - _message "no more options" + _message "unknown localectl command: $words[1]" fi fi } |