From mboxrd@z Thu Jan  1 00:00:00 1970
From: Jonatan Schlag <jonatan.schlag@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH v2 5/5] autocompletion: add color commands
Date: Thu, 15 Jun 2017 18:18:53 +0200
Message-ID: <1497543533-5925-5-git-send-email-jonatan.schlag@ipfire.org>
In-Reply-To: <1497543533-5925-1-git-send-email-jonatan.schlag@ipfire.org>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="===============5235510511668653569=="
List-Id: <development.lists.ipfire.org>

--===============5235510511668653569==
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable

Signed-off-by: Jonatan Schlag <jonatan.schlag(a)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=3D( $(compgen -W "$(network raw list-zones)" -- "${cur}") )
 }
=20
+_network_color() {
+	local words=3D( $@ )
+
+	local commands=3D"set reset"
+	local cmd=3D"$(_network_find_on_cmdline "${commands}")"
+	if [[ -z "${cmd}" ]]; then
+		COMPREPLY=3D( $(compgen -W "${commands}" -- "${cur}") )
+		return 0
+	fi
+}
+
 _network_device() {
 	local words=3D( $@ )
=20
@@ -78,7 +89,7 @@ _network_device_subcommand() {
 		COMPREPLY=3D( $(compgen -W "${commands}" -- "${cur}") )
 		return 0
 	fi
-		=09
+
 	case "${cmd}" in
 		ussd)
 			# TODO
@@ -247,12 +258,20 @@ _network_port() {
 _network_port_subcommand() {
 	local words=3D( $@ )
=20
-	local commands=3D"create down edit identify remove status up"
+	local commands=3D"color create down edit identify remove status up"
 	local cmd=3D"$(_network_find_on_cmdline "${commands}")"
 	if [[ -z "${cmd}" ]]; then
 		COMPREPLY=3D( $(compgen -W "${commands}" -- "${cur}") )
 		return 0
 	fi
+
+	local args=3D"${words[@]:1}"
+	case "${cmd}" in
+		color)
+			_network_color ${args}
+			;;
+	esac
+
 }
=20
 _network_route() {
@@ -359,13 +378,13 @@ _network_zone_subcommand() {
=20
 	local words=3D( $@ )
=20
-	local commands=3D"config disable down edit enable identify port rename stat=
us up"
+	local commands=3D"color config disable down edit enable identify port renam=
e status up"
 	local cmd=3D"$(_network_find_on_cmdline "${commands}")"
 	if [[ -z "${cmd}" ]]; then
 		COMPREPLY=3D( $(compgen -W "${commands}" -- "${cur}") )
 		return 0
 	fi
-		=09
+
 	local args=3D"${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
 }
=20
--=20
2.6.3


--===============5235510511668653569==--