diff options
author | Thomas Haller <thaller@redhat.com> | 2022-09-30 10:00:48 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2022-10-03 13:59:12 +0200 |
commit | 7adde3f2fcde4f9573192cc4f743f8ec435560b4 (patch) | |
tree | f4031d8b1e4b31d6e031474dc50ccff7a9593f8f | |
parent | 394501e65a3ecf81b6dab079b48fa306a265510c (diff) | |
download | NetworkManager-7adde3f2fcde4f9573192cc4f743f8ec435560b4.tar.gz |
nmcli: don't print warning in `nmcli connection import` about duplicate parameters
It seems uncommon that a command line tool warns about duplicate
paramters. Usually, the latter just overwrites the former. That is also
useful so that you can have for example an alias that sets a default
type
nmcli_import="nmcli connection import type keyfile"
but still call it like
nmcli_import file $FILE type openvpn
This is a change in behavior. Not only stop we printing a warning, we
will now prefer the latter argument. Previously, the first was honored.
This change in behavior is a problem, but such uses were warned against
in the past, and hopefully nobody did this or relied on this.
-rw-r--r-- | src/nmcli/connections.c | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index 24cf7e09a3..ee8ce4e2df 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -9650,10 +9650,7 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co NULL); } - if (!type) - type = *argv; - else - g_printerr(_("Warning: 'type' already specified, ignoring extra one.\n")); + type = *argv; } else if (nm_streq(*argv, "file")) { argc--; @@ -9665,10 +9662,8 @@ do_connection_import(const NMCCommand *cmd, NmCli *nmc, int argc, const char *co } if (argc == 1 && nmc->complete) nmc->return_value = NMC_RESULT_COMPLETE_FILE; - if (!filename) - filename = *argv; - else - g_printerr(_("Warning: 'file' already specified, ignoring extra one.\n")); + + filename = *argv; } else { g_string_printf(nmc->return_text, _("Error: invalid extra argument '%s'."), *argv); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; |