mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 23:00:19 +01:00
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.
This commit is contained in:
parent
394501e65a
commit
7adde3f2fc
1 changed files with 3 additions and 8 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue