X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=shell-completion%2Fzsh%2F_hostnamectl;h=e02f6de30edb9512041123de41ea2eb7685b029c;hp=45b9597897c9fa0234e956b9424b528815fe6be7;hb=af93291cc4cbd2fe2fb4af7d3c56138fb39f31dc;hpb=862f4963c6f7778cea9e715eeb11ea959eba6db3;ds=inline diff --git a/shell-completion/zsh/_hostnamectl b/shell-completion/zsh/_hostnamectl index 45b959789..e02f6de30 100644 --- a/shell-completion/zsh/_hostnamectl +++ b/shell-completion/zsh/_hostnamectl @@ -1,11 +1,46 @@ #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_set-deployment() { + if (( CURRENT <= 3 )); then + _message "new environment" + else + _message "no more options" + fi +} + _hostnamectl_command() { local -a _hostnamectl_cmds _hostnamectl_cmds=( "status:Show current hostname settings" "set-hostname:Set system hostname" "set-icon-name:Set icon name for host" + "set-chassis:Set chassis type for host" + "set-deployment:Set deployment environment" ) if (( CURRENT == 1 )); then _describe -t commands 'hostnamectl commands' _hostnamectl_cmds || compadd "$@" @@ -13,8 +48,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