From f0e4137e1dc49c424ca082bd79715fcbab5ee654 Mon Sep 17 00:00:00 2001 From: Dan Williams Date: Mon, 1 Jul 2019 16:37:14 -0500 Subject: cli: complete *-slave types (bond-slave, bridge-slave, team-slave) While shorthand for "type ethernet slave-type " they are accepted as types by nmcli so we might as well complete them. https://bugzilla.redhat.com/show_bug.cgi?id=1654062 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/193 --- clients/common/nm-meta-setting-desc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/clients/common/nm-meta-setting-desc.c b/clients/common/nm-meta-setting-desc.c index c8268da6fc..1422d4d24e 100644 --- a/clients/common/nm-meta-setting-desc.c +++ b/clients/common/nm-meta-setting-desc.c @@ -2466,8 +2466,9 @@ _complete_fcn_connection_type (ARGS_COMPLETE_FCN) guint i, j; char **result; gsize text_len; + const char *slave_types[] = {"bond-slave", "bridge-slave", "team-slave"}; - result = g_new (char *, _NM_META_SETTING_TYPE_NUM * 2 + 1); + result = g_new (char *, _NM_META_SETTING_TYPE_NUM * 2 + G_N_ELEMENTS (slave_types) + 1); text_len = text ? strlen (text) : 0; @@ -2487,6 +2488,12 @@ _complete_fcn_connection_type (ARGS_COMPLETE_FCN) if (!text || strncmp (text, v, text_len) == 0) result[j++] = g_strdup (v); } + for (i = 0; i < G_N_ELEMENTS (slave_types); i++) { + const char *v = slave_types[i]; + + if (!text || strncmp (text, v, text_len) == 0) + result[j++] = g_strdup (v); + } if (j) result[j++] = NULL; else { -- cgit v1.2.1