mirror of
https://github.com/systemd/systemd
synced 2024-10-15 20:45:09 +00:00
zsh: amend completion for networkctl edit
This commit is contained in:
parent
6554f56361
commit
110789987d
|
@ -10,6 +10,8 @@
|
||||||
'lldp:Show Link Layer Discovery Protocol status'
|
'lldp:Show Link Layer Discovery Protocol status'
|
||||||
'label:Show address labels'
|
'label:Show address labels'
|
||||||
'delete:Delete virtual netdevs'
|
'delete:Delete virtual netdevs'
|
||||||
|
'edit:Edit network configurations'
|
||||||
|
'cat:Cat network configurations'
|
||||||
'up:Bring devices up'
|
'up:Bring devices up'
|
||||||
'down:Bring devices down'
|
'down:Bring devices down'
|
||||||
'renew:Renew dynamic configurations'
|
'renew:Renew dynamic configurations'
|
||||||
|
@ -24,10 +26,10 @@
|
||||||
local -a _links
|
local -a _links
|
||||||
cmd="${${_networkctl_cmds[(r)$words[1]:*]%%:*}}"
|
cmd="${${_networkctl_cmds[(r)$words[1]:*]%%:*}}"
|
||||||
case $cmd in
|
case $cmd in
|
||||||
(list|status|up|down|lldp|delete|renew|forcerenew|reconfigure)
|
(list|status|up|down|cat|edit|lldp|delete|renew|forcerenew|reconfigure)
|
||||||
_links=( "${(foa)$(networkctl list --no-legend | awk 'BEGIN{OFS=":"} {sub(/[[ \t]+/, ""); print $2,$0}' 2>/dev/null)}" )
|
for link in ${(f)"$(_call_program links networkctl list --no-legend)"}; do _links+=($link[(w)2]:$link); done
|
||||||
if [[ -n "$_links" ]]; then
|
if [[ -n "$_links" ]]; then
|
||||||
_describe -t links 'links' _links
|
_describe -t links 'links' _links _links $( [[ $cmd == (edit|cat) ]] && print -- -P@ )
|
||||||
else
|
else
|
||||||
_message "no links"
|
_message "no links"
|
||||||
fi
|
fi
|
||||||
|
@ -52,5 +54,7 @@ _arguments \
|
||||||
'--no-legend[Do not print the column headers]' \
|
'--no-legend[Do not print the column headers]' \
|
||||||
{-h,--help}'[Show this help]' \
|
{-h,--help}'[Show this help]' \
|
||||||
'--version[Show package version]' \
|
'--version[Show package version]' \
|
||||||
|
'--drop-in=[Use the given drop-in file name]' \
|
||||||
|
'--no-reload[Do not reload the network manager state when editing]' \
|
||||||
'--json[Shows output formatted as JSON]:format:_networkctl_get_json' \
|
'--json[Shows output formatted as JSON]:format:_networkctl_get_json' \
|
||||||
'*::networkctl commands:_networkctl_commands'
|
'*::networkctl commands:_networkctl_commands'
|
||||||
|
|
Loading…
Reference in a new issue