Blame SOURCES/0019-cli-fix-autocompletion-rh1375933.patch

a85faa
From 76de403335c539b97072d82a7617fc15e1cda423 Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 00:12:37 +0200
a85faa
Subject: [PATCH 1/6] cli: (trivial): remove stray %s
a85faa
a85faa
(cherry picked from commit 4b90b7b774e8f8c5357dd5c4e7e487fbcfb1b693)
a85faa
(cherry picked from commit 5984bdd895cf9d3e30d272a443e971a8121196b6)
a85faa
---
a85faa
 clients/cli/connections.c | 2 +-
a85faa
 1 file changed, 1 insertion(+), 1 deletion(-)
a85faa
a85faa
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
a85faa
index ddd7444..f447d6d 100644
a85faa
--- a/clients/cli/connections.c
a85faa
+++ b/clients/cli/connections.c
a85faa
@@ -4228,7 +4228,7 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_HELLO_TIME,           "hello-time",   OPTION_NONE, N_("Hello time [2]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_MAX_AGE,              "max-age",      OPTION_NONE, N_("Max age [20]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_AGEING_TIME,          "ageing-time",  OPTION_NONE, N_("MAC address ageing time [300]"), NULL, NULL, NULL },
a85faa
-	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_MULTICAST_SNOOPING,   "multicast-snooping", OPTION_NONE, N_("Enable IGMP snooping %s [no]"), NULL,
a85faa
+	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_MULTICAST_SNOOPING,   "multicast-snooping", OPTION_NONE, N_("Enable IGMP snooping [no]"), NULL,
a85faa
                                                                                                         set_yes_no, gen_func_bool_values_l10n },
a85faa
 	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_MAC_ADDRESS,          "mac",          OPTION_NONE, N_("MAC [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_BRIDGE_PORT_SETTING_NAME,  NM_SETTING_BRIDGE_PORT_PRIORITY,        "priority",     OPTION_NONE, N_("Bridge port priority [32]"), NULL, NULL, NULL },
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
From 698ee5801277938b8a6fc196fb3ea68aeb71226d Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 01:20:53 +0200
a85faa
Subject: [PATCH 2/6] cli: (trivial) move gen_func_ifnames() from devices.c to
a85faa
 common.c
a85faa
a85faa
and rename it to nmc_rl_gen_func()
a85faa
a85faa
(cherry picked from commit 1f0ba2e48738cbacb0dc3610bae776bf8f10d7e4)
a85faa
(cherry picked from commit 9d885436171c10b80de8abe75c9c7f2a68308fdf)
a85faa
---
a85faa
 clients/cli/common.c  | 27 +++++++++++++++++++++++++++
a85faa
 clients/cli/common.h  |  1 +
a85faa
 clients/cli/devices.c | 31 ++-----------------------------
a85faa
 3 files changed, 30 insertions(+), 29 deletions(-)
a85faa
a85faa
diff --git a/clients/cli/common.c b/clients/cli/common.c
a85faa
index 62cd6c9..f8dc523 100644
a85faa
--- a/clients/cli/common.c
a85faa
+++ b/clients/cli/common.c
a85faa
@@ -1356,6 +1356,33 @@ nmc_rl_gen_func_basic (const char *text, int state, const char **words)
a85faa
 	return NULL;
a85faa
 }
a85faa
 
a85faa
+char *
a85faa
+nmc_rl_gen_func_ifnames (const char *text, int state)
a85faa
+{
a85faa
+	int i;
a85faa
+	const GPtrArray *devices;
a85faa
+	const char **ifnames;
a85faa
+	char *ret;
a85faa
+
a85faa
+	nm_cli.get_client (&nm_cli);
a85faa
+	devices = nm_client_get_devices (nm_cli.client);
a85faa
+	if (devices->len == 0)
a85faa
+		return NULL;
a85faa
+
a85faa
+	ifnames = g_new (const char *, devices->len + 1);
a85faa
+	for (i = 0; i < devices->len; i++) {
a85faa
+		NMDevice *dev = g_ptr_array_index (devices, i);
a85faa
+		const char *ifname = nm_device_get_iface (dev);
a85faa
+		ifnames[i] = ifname;
a85faa
+	}
a85faa
+	ifnames[i] = NULL;
a85faa
+
a85faa
+	ret = nmc_rl_gen_func_basic (text, state, ifnames);
a85faa
+
a85faa
+	g_free (ifnames);
a85faa
+	return ret;
a85faa
+}
a85faa
+
a85faa
 /* for pre-filling a string to readline prompt */
a85faa
 char *nmc_rl_pre_input_deftext;
a85faa
 
a85faa
diff --git a/clients/cli/common.h b/clients/cli/common.h
a85faa
index 579c44a..114a8e6 100644
a85faa
--- a/clients/cli/common.h
a85faa
+++ b/clients/cli/common.h
a85faa
@@ -65,6 +65,7 @@ void nmc_cleanup_readline (void);
a85faa
 char *nmc_readline (const char *prompt_fmt, ...) G_GNUC_PRINTF (1, 2);
a85faa
 char *nmc_readline_echo (gboolean echo_on, const char *prompt_fmt, ...) G_GNUC_PRINTF (2, 3);
a85faa
 char *nmc_rl_gen_func_basic (const char *text, int state, const char **words);
a85faa
+char *nmc_rl_gen_func_ifnames (const char *text, int state);
a85faa
 gboolean nmc_get_in_readline (void);
a85faa
 void nmc_set_in_readline (gboolean in_readline);
a85faa
 
a85faa
diff --git a/clients/cli/devices.c b/clients/cli/devices.c
a85faa
index 32c84bb..550f0c2 100644
a85faa
--- a/clients/cli/devices.c
a85faa
+++ b/clients/cli/devices.c
a85faa
@@ -3813,33 +3813,6 @@ is_single_word (const char* line)
a85faa
 		return FALSE;
a85faa
 }
a85faa
 
a85faa
-static char *
a85faa
-gen_func_ifnames (const char *text, int state)
a85faa
-{
a85faa
-	int i;
a85faa
-	const GPtrArray *devices;
a85faa
-	const char **ifnames;
a85faa
-	char *ret;
a85faa
-
a85faa
-	nm_cli.get_client (&nm_cli);
a85faa
-	devices = nm_client_get_devices (nm_cli.client);
a85faa
-	if (devices->len == 0)
a85faa
-		return NULL;
a85faa
-
a85faa
-	ifnames = g_new (const char *, devices->len + 1);
a85faa
-	for (i = 0; i < devices->len; i++) {
a85faa
-		NMDevice *dev = g_ptr_array_index (devices, i);
a85faa
-		const char *ifname = nm_device_get_iface (dev);
a85faa
-		ifnames[i] = ifname;
a85faa
-	}
a85faa
-	ifnames[i] = NULL;
a85faa
-
a85faa
-	ret = nmc_rl_gen_func_basic (text, state, ifnames);
a85faa
-
a85faa
-	g_free (ifnames);
a85faa
-	return ret;
a85faa
-}
a85faa
-
a85faa
 static char **
a85faa
 nmcli_device_tab_completion (const char *text, int start, int end)
a85faa
 {
a85faa
@@ -3856,9 +3829,9 @@ nmcli_device_tab_completion (const char *text, int start, int end)
a85faa
 		if (!is_single_word (rl_line_buffer))
a85faa
 			return NULL;
a85faa
 
a85faa
-		generator_func = gen_func_ifnames;
a85faa
+		generator_func = nmc_rl_gen_func_ifnames;
a85faa
 	} else if (g_strcmp0 (rl_prompt, PROMPT_INTERFACES) == 0) {
a85faa
-		generator_func = gen_func_ifnames;
a85faa
+		generator_func = nmc_rl_gen_func_ifnames;
a85faa
 	}
a85faa
 
a85faa
 	if (generator_func)
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
From 1b2883b9406c9bfb24bd50e6a5ff22fd063c0db0 Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 00:11:17 +0200
a85faa
Subject: [PATCH 3/6] cli: fix completion/add missing functions for
a85faa
 '--complete-args' (rh #1375933)
a85faa
a85faa
This makes bash completion work again for 'nmcli connection add'.
a85faa
a85faa
Fixes: 8b39090597159dea52b5ffb760395ab593c7a3dc
a85faa
a85faa
https://bugzilla.redhat.com/show_bug.cgi?id=1375933
a85faa
(cherry picked from commit 61a56aa3db9a8d95658fe75c781b6337b0d1847e)
a85faa
(cherry picked from commit 68be811f8170e48e856589e6331ffef632e2052f)
a85faa
---
a85faa
 clients/cli/connections.c | 38 ++++++++++++++++++++++++++++----------
a85faa
 1 file changed, 28 insertions(+), 10 deletions(-)
a85faa
a85faa
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
a85faa
index f447d6d..2e81f4a 100644
a85faa
--- a/clients/cli/connections.c
a85faa
+++ b/clients/cli/connections.c
a85faa
@@ -3756,6 +3756,12 @@ ensure_settings (NMConnection *connection, const NameItem *item)
a85faa
 
a85faa
 /*----------------------------------------------------------------------------*/
a85faa
 
a85faa
+static char *
a85faa
+gen_func_slave_type (const char *text, int state)
a85faa
+{
a85faa
+	const char *words[] = { "bond", "team", "bridge", NULL };
a85faa
+	return nmc_rl_gen_func_basic (text, state, words);
a85faa
+}
a85faa
 
a85faa
 static char *
a85faa
 gen_func_vpn_types (const char *text, int state)
a85faa
@@ -3807,6 +3813,12 @@ gen_func_bond_mon_mode (const char *text, int state)
a85faa
 	const char *words[] = { "miimon", "arp", NULL };
a85faa
 	return nmc_rl_gen_func_basic (text, state, words);
a85faa
 }
a85faa
+static char *
a85faa
+gen_func_bond_lacp_rate (const char *text, int state)
a85faa
+{
a85faa
+	const char *words[] = { "slow", "fast", NULL };
a85faa
+	return nmc_rl_gen_func_basic (text, state, words);
a85faa
+}
a85faa
 
a85faa
 static char *
a85faa
 gen_func_adsl_proto (const char *text, int state)
a85faa
@@ -4165,11 +4177,14 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_TYPE,             "type",         OPTION_REQD, PROMPT_CON_TYPE, NULL,
a85faa
                                                                                                         set_connection_type, gen_connection_types },
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_ID,               "con-name",     OPTION_DONT_ASK, NULL, NULL, NULL, NULL },
a85faa
-	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_AUTOCONNECT,      "autoconnect",  OPTION_DONT_ASK, NULL, NULL, NULL, gen_func_bool_values_l10n },
a85faa
-	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_INTERFACE_NAME,   "ifname",       OPTION_REQD, N_("Interface name [*]"), NULL, set_connection_iface, NULL },
a85faa
+	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_AUTOCONNECT,      "autoconnect",  OPTION_DONT_ASK, NULL, NULL, NULL,
a85faa
+                                                                                                        gen_func_bool_values_l10n },
a85faa
+	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_INTERFACE_NAME,   "ifname",       OPTION_REQD, N_("Interface name [*]"), NULL,
a85faa
+                                                                                                        set_connection_iface, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_MASTER,           "master",       OPTION_DONT_ASK, PROMPT_MASTER, NULL,
a85faa
                                                                                                         set_connection_master, gen_func_master_ifnames },
a85faa
-	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_SLAVE_TYPE,       "slave-type",   OPTION_DONT_ASK, NULL, NULL, NULL, NULL },
a85faa
+	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_SLAVE_TYPE,       "slave-type",   OPTION_DONT_ASK, NULL, NULL, NULL,
a85faa
+                                                                                                        gen_func_slave_type },
a85faa
 	{ NM_SETTING_PPPOE_SETTING_NAME,        NM_SETTING_PPPOE_USERNAME,              "username",     OPTION_REQD, N_("PPPoE username"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_PPPOE_SETTING_NAME,        NM_SETTING_PPPOE_PASSWORD,              "password",     OPTION_NONE, N_("Password [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_PPPOE_SETTING_NAME,        NM_SETTING_PPPOE_SERVICE,               "service",      OPTION_NONE, N_("Service [none]"), NULL, NULL, NULL },
a85faa
@@ -4199,7 +4214,7 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_BLUETOOTH_SETTING_NAME,    NM_SETTING_BLUETOOTH_TYPE,              "bt-type",      OPTION_NONE, PROMPT_BT_TYPE, PROMPT_BT_TYPE_CHOICES,
a85faa
                                                                                                         set_bluetooth_type, gen_func_bt_type },
a85faa
 	{ NM_SETTING_VLAN_SETTING_NAME,         NM_SETTING_VLAN_PARENT,                 "dev",          OPTION_REQD, N_("VLAN parent device or connection UUID"), NULL,
a85faa
-                                                                                                        NULL, NULL },
a85faa
+                                                                                                        NULL, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_VLAN_SETTING_NAME,         NM_SETTING_VLAN_ID,                     "id",           OPTION_REQD, N_("VLAN ID (<0-4094>)"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_VLAN_SETTING_NAME,         NM_SETTING_VLAN_FLAGS,                  "flags",        OPTION_NONE, N_("VLAN flags (<0-7>) [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_VLAN_SETTING_NAME,         NM_SETTING_VLAN_INGRESS_PRIORITY_MAP,   "ingress",      OPTION_NONE, N_("Ingress priority maps [none]"), NULL, NULL, NULL },
a85faa
@@ -4207,7 +4222,7 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                "mode",         OPTION_NONE, PROMPT_BOND_MODE, "[balance-rr]",
a85faa
                                                                                                         set_bond_option, gen_func_bond_mode },
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                "primary",      OPTION_DONT_ASK, N_("Bonding primary interface [none]"),
a85faa
-                                                                                                        NULL, set_bond_option, NULL },
a85faa
+                                                                                                        NULL, set_bond_option, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                NULL,           OPTION_NONE, N_("Bonding monitoring mode"), PROMPT_BOND_MON_MODE_CHOICES,
a85faa
                                                                                                         set_bond_monitoring_mode, gen_func_bond_mon_mode },
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                "miimon",       OPTION_DONT_ASK, N_("Bonding miimon [100]"), NULL, set_bond_option, NULL },
a85faa
@@ -4218,7 +4233,7 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                "arp-ip-target", OPTION_DONT_ASK, N_("Bonding arp-ip-target [none]"),
a85faa
                                                                                                         NULL, set_bond_option, NULL },
a85faa
 	{ NM_SETTING_BOND_SETTING_NAME,         NM_SETTING_BOND_OPTIONS,                "lacp-rate",    OPTION_DONT_ASK, N_("LACP rate ('slow' or 'fast') [slow]"), NULL,
a85faa
-                                                                                                        set_bond_option, NULL },
a85faa
+                                                                                                        set_bond_option, gen_func_bond_lacp_rate },
a85faa
 	{ NM_SETTING_TEAM_SETTING_NAME,         NM_SETTING_TEAM_CONFIG,                 "config",       OPTION_NONE, N_("Team JSON configuration [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_TEAM_PORT_SETTING_NAME,    NM_SETTING_TEAM_PORT_CONFIG,            "config",       OPTION_NONE, N_("Team JSON configuration [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_BRIDGE_SETTING_NAME,       NM_SETTING_BRIDGE_STP,                  "stp",          OPTION_NONE, N_("Enable STP [no]"), NULL,
a85faa
@@ -4247,13 +4262,15 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_ADSL_SETTING_NAME,         NM_SETTING_ADSL_ENCAPSULATION,          "encapsulation", OPTION_NONE, PROMPT_ADSL_ENCAP, PROMPT_ADSL_ENCAP_CHOICES,
a85faa
                                                                                                         NULL, gen_func_adsl_encap },
a85faa
 	{ NM_SETTING_MACVLAN_SETTING_NAME,      NM_SETTING_MACVLAN_PARENT,              "dev",          OPTION_REQD, N_("MACVLAN parent device or connection UUID"), NULL,
a85faa
-                                                                                                        NULL, NULL },
a85faa
-	{ NM_SETTING_MACVLAN_SETTING_NAME,      NM_SETTING_MACVLAN_MODE,                "mode",         OPTION_REQD, PROMPT_MACVLAN_MODE, NULL, NULL, gen_func_macvlan_mode },
a85faa
+                                                                                                        NULL, nmc_rl_gen_func_ifnames },
a85faa
+	{ NM_SETTING_MACVLAN_SETTING_NAME,      NM_SETTING_MACVLAN_MODE,                "mode",         OPTION_REQD, PROMPT_MACVLAN_MODE, NULL,
a85faa
+                                                                                                        NULL, gen_func_macvlan_mode },
a85faa
 	{ NM_SETTING_MACVLAN_SETTING_NAME,      NM_SETTING_MACVLAN_TAP,                 "tap",          OPTION_NONE, N_("Tap [no]"), NULL,
a85faa
                                                                                                         set_yes_no, gen_func_bool_values_l10n },
a85faa
 	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_ID,                    "id",           OPTION_REQD, N_("VXLAN ID"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_REMOTE,                "remote",       OPTION_REQD, N_("Remote"), NULL, NULL, NULL },
a85faa
-	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_PARENT,                "dev",          OPTION_NONE, N_("Parent device [none]"), NULL, NULL, NULL },
a85faa
+	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_PARENT,                "dev",          OPTION_NONE, N_("Parent device [none]"), NULL,
a85faa
+                                                                                                        NULL, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_LOCAL,                 "local",        OPTION_NONE, N_("Local address [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_SOURCE_PORT_MIN,       "source-port-min", OPTION_NONE, N_("Minimum source port [0]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_VXLAN_SETTING_NAME,        NM_SETTING_VXLAN_SOURCE_PORT_MAX,       "source-port-max", OPTION_NONE, N_("Maximum source port [0]"), NULL, NULL, NULL },
a85faa
@@ -4271,7 +4288,8 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_IP_TUNNEL_SETTING_NAME,    NM_SETTING_IP_TUNNEL_MODE,              "mode",         OPTION_REQD, PROMPT_IP_TUNNEL_MODE, NULL, NULL, gen_func_ip_tunnel_mode },
a85faa
 	{ NM_SETTING_IP_TUNNEL_SETTING_NAME,    NM_SETTING_IP_TUNNEL_LOCAL,             "local",        OPTION_NONE, N_("Local endpoint [none]"), NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_IP_TUNNEL_SETTING_NAME,    NM_SETTING_IP_TUNNEL_REMOTE,            "remote",       OPTION_REQD, N_("Remote"), NULL, NULL, NULL },
a85faa
-	{ NM_SETTING_IP_TUNNEL_SETTING_NAME,    NM_SETTING_IP_TUNNEL_PARENT,            "dev",          OPTION_NONE, N_("Parent device [none]"), NULL, NULL, NULL },
a85faa
+	{ NM_SETTING_IP_TUNNEL_SETTING_NAME,    NM_SETTING_IP_TUNNEL_PARENT,            "dev",          OPTION_NONE, N_("Parent device [none]"), NULL,
a85faa
+                                                                                                        NULL, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_IP4_CONFIG_SETTING_NAME,   NM_SETTING_IP_CONFIG_ADDRESSES,         "ip4",          OPTION_MULTI, N_("IPv4 address (IP[/plen]) [none]"), NULL,
a85faa
 	                                                                                                set_ip4_address, NULL },
a85faa
 	{ NM_SETTING_IP4_CONFIG_SETTING_NAME,   NM_SETTING_IP_CONFIG_GATEWAY,           "gw4",          OPTION_NONE, N_("IPv4 gateway [none]"), NULL, NULL, NULL },
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
From a207b193ee91d47d9fc2445927b817de61aadb6b Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 02:49:21 +0200
a85faa
Subject: [PATCH 4/6] cli: enable bash completion for some more properties of
a85faa
 add/modify
a85faa
a85faa
connection.interface-name
a85faa
mavclan.tap
a85faa
mavclan.parent
a85faa
ip-tunnel.parent
a85faa
vxlan.parent
a85faa
a85faa
(cherry picked from commit c2ef39786702a81713834b31a695ac0a1e9e2a50)
a85faa
(cherry picked from commit ebfa947e83461ca55d623f2ad8d0835f16ea48f3)
a85faa
---
a85faa
 clients/cli/connections.c | 24 +++++++++++++++++-------
a85faa
 1 file changed, 17 insertions(+), 7 deletions(-)
a85faa
a85faa
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
a85faa
index 2e81f4a..69131c1 100644
a85faa
--- a/clients/cli/connections.c
a85faa
+++ b/clients/cli/connections.c
a85faa
@@ -4383,6 +4383,8 @@ complete_property (const gchar *setting_name, const gchar *property, const gchar
a85faa
 			run_rl_generator (gen_connection_types, prefix);
a85faa
 		else if (strcmp (property, NM_SETTING_CONNECTION_MASTER) == 0)
a85faa
 			run_rl_generator (gen_func_master_ifnames, prefix);
a85faa
+		else if (strcmp (property, NM_SETTING_CONNECTION_INTERFACE_NAME) == 0)
a85faa
+			run_rl_generator (nmc_rl_gen_func_ifnames, prefix);
a85faa
 	} else if (   strcmp (setting_name, NM_SETTING_VPN_SETTING_NAME) == 0
a85faa
 	           && strcmp (property, NM_SETTING_VPN_SERVICE_TYPE) == 0)
a85faa
 		run_rl_generator (gen_func_vpn_types, prefix);
a85faa
@@ -4403,13 +4405,21 @@ complete_property (const gchar *setting_name, const gchar *property, const gchar
a85faa
 	} else if (   strcmp (setting_name, NM_SETTING_TUN_SETTING_NAME) == 0
a85faa
 	           && strcmp (property, NM_SETTING_TUN_MODE) == 0)
a85faa
 		run_rl_generator (gen_func_tun_mode, prefix);
a85faa
-	else if (   strcmp (setting_name, NM_SETTING_IP_TUNNEL_SETTING_NAME) == 0
a85faa
-	         && strcmp (property, NM_SETTING_IP_TUNNEL_MODE) == 0)
a85faa
-		run_rl_generator (gen_func_ip_tunnel_mode, prefix);
a85faa
-	else if (   strcmp (setting_name, NM_SETTING_MACVLAN_SETTING_NAME) == 0
a85faa
-	         && strcmp (property, NM_SETTING_MACVLAN_MODE) == 0)
a85faa
-		run_rl_generator (gen_func_macvlan_mode, prefix);
a85faa
-
a85faa
+	else if (strcmp (setting_name, NM_SETTING_IP_TUNNEL_SETTING_NAME) == 0) {
a85faa
+		if (strcmp (property, NM_SETTING_IP_TUNNEL_MODE) == 0)
a85faa
+			run_rl_generator (gen_func_ip_tunnel_mode, prefix);
a85faa
+		else if (strcmp (property, NM_SETTING_IP_TUNNEL_PARENT) == 0)
a85faa
+			run_rl_generator (nmc_rl_gen_func_ifnames, prefix);
a85faa
+	} else if (strcmp (setting_name, NM_SETTING_MACVLAN_SETTING_NAME) == 0) {
a85faa
+		if (strcmp (property, NM_SETTING_MACVLAN_MODE) == 0)
a85faa
+			run_rl_generator (gen_func_macvlan_mode, prefix);
a85faa
+		else if (strcmp (property, NM_SETTING_MACVLAN_PARENT) == 0)
a85faa
+			run_rl_generator (nmc_rl_gen_func_ifnames, prefix);
a85faa
+		else if (strcmp (property, NM_SETTING_MACVLAN_TAP) == 0)
a85faa
+			run_rl_generator (gen_func_bool_values_l10n, prefix);
a85faa
+	} else if (   strcmp (setting_name, NM_SETTING_VXLAN_SETTING_NAME) == 0
a85faa
+	           && strcmp (property, NM_SETTING_VXLAN_PARENT) == 0)
a85faa
+		run_rl_generator (nmc_rl_gen_func_ifnames, prefix);
a85faa
 }
a85faa
 
a85faa
 /*----------------------------------------------------------------------------*/
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
From 8473ae0e27dcb1e7f8364624530b6338e228f516 Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 10:32:44 +0200
a85faa
Subject: [PATCH 5/6] cli: tab-complete "Interface name [*]" in questionnaire
a85faa
 mode
a85faa
a85faa
(cherry picked from commit 08a74c272b6c0bf5bb0c9cfd84ae72d67539f9be)
a85faa
(cherry picked from commit afb65df37a82a1108c9748984c03af8ac053f773)
a85faa
---
a85faa
 clients/cli/connections.c | 6 +++++-
a85faa
 1 file changed, 5 insertions(+), 1 deletion(-)
a85faa
a85faa
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
a85faa
index 69131c1..41668fb 100644
a85faa
--- a/clients/cli/connections.c
a85faa
+++ b/clients/cli/connections.c
a85faa
@@ -65,6 +65,7 @@ struct _OptionInfo {
a85faa
 
a85faa
 /* define some other prompts */
a85faa
 #define PROMPT_CON_TYPE    N_("Connection type")
a85faa
+#define PROMPT_IFNAME      N_("Interface name [*]")
a85faa
 #define PROMPT_VPN_TYPE    N_("VPN type")
a85faa
 #define PROMPT_MASTER      N_("Master")
a85faa
 
a85faa
@@ -4179,7 +4180,7 @@ static OptionInfo option_info[] = {
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_ID,               "con-name",     OPTION_DONT_ASK, NULL, NULL, NULL, NULL },
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_AUTOCONNECT,      "autoconnect",  OPTION_DONT_ASK, NULL, NULL, NULL,
a85faa
                                                                                                         gen_func_bool_values_l10n },
a85faa
-	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_INTERFACE_NAME,   "ifname",       OPTION_REQD, N_("Interface name [*]"), NULL,
a85faa
+	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_INTERFACE_NAME,   "ifname",       OPTION_REQD, PROMPT_IFNAME, NULL,
a85faa
                                                                                                         set_connection_iface, nmc_rl_gen_func_ifnames },
a85faa
 	{ NM_SETTING_CONNECTION_SETTING_NAME,   NM_SETTING_CONNECTION_MASTER,           "master",       OPTION_DONT_ASK, PROMPT_MASTER, NULL,
a85faa
                                                                                                         set_connection_master, gen_func_master_ifnames },
a85faa
@@ -4420,6 +4421,7 @@ complete_property (const gchar *setting_name, const gchar *property, const gchar
a85faa
 	} else if (   strcmp (setting_name, NM_SETTING_VXLAN_SETTING_NAME) == 0
a85faa
 	           && strcmp (property, NM_SETTING_VXLAN_PARENT) == 0)
a85faa
 		run_rl_generator (nmc_rl_gen_func_ifnames, prefix);
a85faa
+
a85faa
 }
a85faa
 
a85faa
 /*----------------------------------------------------------------------------*/
a85faa
@@ -4647,6 +4649,8 @@ nmcli_con_add_tab_completion (const char *text, int start, int end)
a85faa
 
a85faa
 	if (g_str_has_prefix (rl_prompt, PROMPT_CON_TYPE))
a85faa
 		generator_func = gen_connection_types;
a85faa
+	else if (g_str_has_prefix (rl_prompt, PROMPT_IFNAME))
a85faa
+		generator_func = nmc_rl_gen_func_ifnames;
a85faa
 	else if (g_str_has_prefix (rl_prompt, PROMPT_VPN_TYPE))
a85faa
 		generator_func = gen_func_vpn_types;
a85faa
 	else if (g_str_has_prefix (rl_prompt, PROMPT_MASTER))
a85faa
-- 
a85faa
2.7.4
a85faa
a85faa
From 40ef13b5e7c168ead1cf883c2a464c9b12e8debf Mon Sep 17 00:00:00 2001
a85faa
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <blueowl@centrum.cz>
a85faa
Date: Thu, 15 Sep 2016 03:05:00 +0200
a85faa
Subject: [PATCH 6/6] cli: fix yes/no completion in questionnaire mode
a85faa
a85faa
(cherry picked from commit 52723bd74303df20cbb95c0c2dceb3a31e5f788e)
a85faa
(cherry picked from commit a695ed8ad6c3d4547b1756d784b88241109d9eff)
a85faa
---
a85faa
 clients/cli/connections.c | 4 ++--
a85faa
 1 file changed, 2 insertions(+), 2 deletions(-)
a85faa
a85faa
diff --git a/clients/cli/connections.c b/clients/cli/connections.c
a85faa
index 41668fb..dfd619c 100644
a85faa
--- a/clients/cli/connections.c
a85faa
+++ b/clients/cli/connections.c
a85faa
@@ -4635,8 +4635,8 @@ nmcli_con_add_tab_completion (const char *text, int start, int end)
a85faa
 {
a85faa
 	char **match_array = NULL;
a85faa
 	rl_compentry_func_t *generator_func = NULL;
a85faa
-	gs_free char *no = g_strdup_printf (": [%s]", gettext ("no"));
a85faa
-	gs_free char *yes = g_strdup_printf (": [%s]", gettext ("yes"));
a85faa
+	gs_free char *no = g_strdup_printf ("[%s]: ", gettext ("no"));
a85faa
+	gs_free char *yes = g_strdup_printf ("[%s]: ", gettext ("yes"));
a85faa
 
a85faa
 	/* Disable readline's default filename completion */
a85faa
 	rl_attempted_completion_over = 1;
a85faa
-- 
a85faa
2.7.4
a85faa