cli: fix connection type completion

Don't show completion for all setting types but only for base ones.

Before:
 $ nmcli connection add type <TAB>
 802-11-olpc-mesh          ethernet                  ppp
 802-11-wireless           generic                   pppoe
 802-11-wireless-security  gsm                       proxy
 802-1x                    infiniband                serial
 802-3-ethernet            ip-tunnel                 team
 adsl                      ipv4                      team-port
 bluetooth                 ipv6                      tun
 bond                      macsec                    user
 bridge                    macvlan                   vlan
 bridge-port               olpc-mesh                 vpn
 cdma                      ovs-bridge                vxlan
 connection                ovs-interface             wifi
 dcb                       ovs-patch                 wifi-sec
 dummy                     ovs-port                  wimax

After:
 $ nmcli connection add type <TAB>
 802-11-olpc-mesh  cdma              macsec            team
 802-11-wireless   dummy             macvlan           tun
 802-3-ethernet    ethernet          olpc-mesh         vlan
 adsl              generic           ovs-bridge        vpn
 bluetooth         gsm               ovs-interface     vxlan
 bond              infiniband        ovs-port          wifi
 bridge            ip-tunnel         pppoe             wimax
This commit is contained in:
Beniamino Galvani
2017-11-20 21:55:06 +01:00
parent b8c87a7ceb
commit 60f57ebe4a

View File

@@ -2310,6 +2310,9 @@ _complete_fcn_connection_type (ARGS_COMPLETE_FCN)
const NMMetaSettingInfoEditor *setting_info = &nm_meta_setting_infos_editor[i];
const char *v;
if (!setting_info->valid_parts)
continue;
v = setting_info->alias;
if (v) {
if (!text || strncmp (text, v, text_len) == 0)