Signed-off-by: Jonatan Schlag jonatan.schlag@ipfire.org --- src/bash-completion/network | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/bash-completion/network b/src/bash-completion/network index 4b5e34d..091c1cb 100644 --- a/src/bash-completion/network +++ b/src/bash-completion/network @@ -48,6 +48,17 @@ _network_complete_zones() { COMPREPLY=( $(compgen -W "$(network raw list-zones)" -- "${cur}") ) }
+_network_color() { + local words=( $@ ) + + local commands="set reset" + local cmd="$(_network_find_on_cmdline "${commands}")" + if [[ -z "${cmd}" ]]; then + COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) + return 0 + fi +} + _network_device() { local words=( $@ )
@@ -78,7 +89,7 @@ _network_device_subcommand() { COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) return 0 fi - + case "${cmd}" in ussd) # TODO @@ -247,12 +258,20 @@ _network_port() { _network_port_subcommand() { local words=( $@ )
- local commands="create down edit identify remove status up" + local commands="color create down edit identify remove status up" local cmd="$(_network_find_on_cmdline "${commands}")" if [[ -z "${cmd}" ]]; then COMPREPLY=( $(compgen -W "${commands}" -- "${cur}") ) return 0 fi + + local args="${words[@]:1}" + case "${cmd}" in + color) + _network_color ${args} + ;; + esac + }
_network_route() { @@ -359,13 +378,13 @@ _network_zone_subcommand() {
local words=( $@ )
- local commands="config disable down edit enable identify port rename status up" + local commands="color config 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}") ) return 0 fi - + local args="${words[@]:1}" case "${cmd}" in config) @@ -374,6 +393,9 @@ _network_zone_subcommand() { port) _network_zone_subcommand_port "${zone}" ${args} ;; + color) + _network_color ${args} + ;; esac }