diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-02-13 10:49:51 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-02-13 16:09:16 +0100 |
commit | e27963d17ff45ccb5ab71f932d6ed17a59380ec6 (patch) | |
tree | a41bcad5eafdb7031b5dbf94c941cb7f49e9bafb | |
parent | 6cba687bb3ffc027a7ab03e6019e10f304989d6b (diff) | |
download | NetworkManager-e27963d17ff45ccb5ab71f932d6ed17a59380ec6.tar.gz |
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
-rw-r--r-- | clients/cli/connections.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/clients/cli/connections.c b/clients/cli/connections.c index f08644db6f..705d3c25a6 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -1653,16 +1653,17 @@ get_connection (NmCli *nmc, int *argc, char ***argv, int *pos, GError **error) if (*argc == 1 && nmc->complete) nmc_complete_strings (**argv, "id", "uuid", "path", NULL); - if ( strcmp (**argv, "id") == 0 - || strcmp (**argv, "uuid") == 0 - || strcmp (**argv, "path") == 0) { - selector = **argv; - (*argc)--; - (*argv)++; - if (!*argc) { - g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, - _("%s argument is missing"), selector); - return NULL; + if (NM_IN_STRSET (**argv, "id", "uuid", "path")) { + if (*argc == 1) { + if (!nmc->complete) { + g_set_error (error, NMCLI_ERROR, NMC_RESULT_ERROR_USER_INPUT, + _("%s argument is missing"), selector); + return NULL; + } + } else { + selector = **argv; + (*argv)++; + (*argc)--; } } |