From 7adde3f2fcde4f9573192cc4f743f8ec435560b4 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 30 Sep 2022 10:00:48 +0200 Subject: 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. --- src/nmcli/connections.c | 11 +++-------- 1 file 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; -- cgit v1.2.1