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