cli: autocomplete connection type even if it has an alias

Before, we would not autocomplete connection types that have an alias:

Connection type: <TAB><TAB>
6lowpan           cdma              macvlan           vlan
802-11-olpc-mesh  dummy             olpc-mesh         vpn
802-11-wireless   ethernet          ovs-bridge        vxlan
802-3-ethernet    generic           ovs-interface     wifi
adsl              gsm               ovs-port          wimax
bluetooth         infiniband        pppoe             wpan
bond              ip-tunnel         team
bridge            macsec            tun
Connection type: 8<TAB> [-> no completion]

Don't treat the default connection type (for example,
"802-3-ethernet") in a special way and allow it to be autocompleted,
because we already display it when the user did not enter any text.
This commit is contained in:
Beniamino Galvani 2018-08-24 09:52:09 +02:00
parent 1669377110
commit 2f60fdf19e

View file

@ -2485,11 +2485,9 @@ _complete_fcn_connection_type (ARGS_COMPLETE_FCN)
if (!text || strncmp (text, v, text_len) == 0)
result[j++] = g_strdup (v);
}
if (!text || !*text || !v) {
v = setting_info->general->setting_name;
if (!text || strncmp (text, v, text_len) == 0)
result[j++] = g_strdup (v);
}
v = setting_info->general->setting_name;
if (!text || strncmp (text, v, text_len) == 0)
result[j++] = g_strdup (v);
}
if (j)
result[j++] = NULL;