]> git.ipfire.org Git - people/stevee/network.git/commitdiff
autocompletion: add description support
authorJonatan Schlag <jonatan.schlag@ipfire.org>
Mon, 19 Jun 2017 19:20:50 +0000 (21:20 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 22 Jun 2017 14:31:18 +0000 (16:31 +0200)
Signed-off-by: Jonatan Schlag <jonatan.schlag@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/bash-completion/network

index 091c1cb4a824de6bdb15706e09c43f4d129867f9..f7c58a93359ddb0e100ef76f9295ef6d5e4b5524 100644 (file)
@@ -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
 }