Commit 43d93e7c authored by Thomas Haller's avatar Thomas Haller

cli: tab complete only full D-Bus paths if there is no prefix

When tab completing connections by path name without any already
typed parts, only suggest full D-Bus paths. The numbers are duplicate
and not preferred.

Before:

    $ nmcli connection show path <TAB>
    Display all 118 possibilities? (y or n)
    1                                            46                                           /org/freedesktop/NetworkManager/Settings/29
    10                                           47                                           /org/freedesktop/NetworkManager/Settings/3
    11                                           48                                           /org/freedesktop/NetworkManager/Settings/30
    12                                           49                                           /org/freedesktop/NetworkManager/Settings/31
    13                                           5                                            /org/freedesktop/NetworkManager/Settings/32

Afterwards:

    $ nmcli connection show path <TAB>
    /org/freedesktop/NetworkManager/Settings/1   /org/freedesktop/NetworkManager/Settings/28  /org/freedesktop/NetworkManager/Settings/46
    ...

and

    $ nmcli connection modify path 4<TAB>
    4   40  41  42  43  44  45  46  47  48  49
parent 68bd018a
Pipeline #30830 failed with stages
in 32 minutes and 54 seconds
......@@ -465,7 +465,7 @@ nmc_find_connection (const GPtrArray *connections,
v = nm_connection_get_path (connection);
v_num = nm_utils_dbus_path_get_last_component (v);
if (complete && (filter_type || *filter_val))
nmc_complete_strings (filter_val, v, filter_type ? v_num : NULL);
nmc_complete_strings (filter_val, v, (*filter_val ? v_num : NULL));
if ( nm_streq0 (filter_val, v)
|| (filter_type && nm_streq0 (filter_val, v_num)))
goto found;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment