cli: complete *-slave types (bond-slave, bridge-slave, team-slave)

While shorthand for "type ethernet slave-type <foo>" 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
This commit is contained in:
Dan Williams 2019-07-01 16:37:14 -05:00 committed by Thomas Haller
parent e92dca357f
commit f0e4137e1d

View file

@ -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 {