From: Jonatan Schlag Date: Mon, 19 Jun 2017 19:20:50 +0000 (+0200) Subject: autocompletion: add description support X-Git-Tag: 009~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9d3ac4e43e607f5278d1b260227f2eb1c58f4f55;p=network.git autocompletion: add description support Signed-off-by: Jonatan Schlag Signed-off-by: Michael Tremer --- diff --git a/src/bash-completion/network b/src/bash-completion/network index 091c1cb4..f7c58a93 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -59,6 +59,16 @@ _network_color() { fi } +_network_description() { + local words=( $@ ) + + local commands="edit show" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi +} _network_device() { local words=( $@ ) @@ -258,7 +268,7 @@ _network_port() { _network_port_subcommand() { local words=( $@ ) - local commands="color create down edit identify remove status up" + local commands="color create description down edit identify remove status up" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) @@ -270,6 +280,9 @@ _network_port_subcommand() { color) _network_color ${args} ;; + description) + _network_description ${args} + ;; esac } @@ -378,7 +391,7 @@ _network_zone_subcommand() { local words=( $@ ) - local commands="color config disable down edit enable identify port rename status up" + local commands="color config description disable down edit enable identify port rename status up" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) @@ -396,6 +409,9 @@ _network_zone_subcommand() { color) _network_color ${args} ;; + description) + _network_description ${args} + ;; esac }