cli: fix connections completion

Let the matching continue when we are autocompleting arguments and we
have already found 'id', 'uuid' or 'path'.

Before:

 # nmcli connection modify path<TAB>
 path

After:
 # nmcli connection modify path<TAB>
 path
 pathfinder-wifi
This commit is contained in:
Beniamino Galvani 2018-02-13 10:49:51 +01:00
parent 6cba687bb3
commit e27963d17f

View file

@ -1653,16 +1653,17 @@ get_connection (NmCli *nmc, int *argc, char ***argv, int *pos, GError **error)
if (*argc == 1 && nmc->complete) if (*argc == 1 && nmc->complete)
nmc_complete_strings (**argv, "id", "uuid", "path", NULL); nmc_complete_strings (**argv, "id", "uuid", "path", NULL);
if ( strcmp (**argv, "id") == 0 if (NM_IN_STRSET (**argv, "id", "uuid", "path")) {
|| strcmp (**argv, "uuid") == 0 if (*argc == 1) {
|| strcmp (**argv, "path") == 0) { if (!nmc->complete) {
selector = **argv; g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT,
(*argc)--; _("%s argument is missing"), selector);
(*argv)++; return NULL;
if (!*argc) { }
g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, } else {
_("%s argument is missing"), selector); selector = **argv;
return NULL; (*argv)++;
(*argc)--;
} }
} }