Commit 88e4dcab authored by Adam Williamson's avatar Adam Williamson Committed by Lubomir Rintel

editor: handle --keep-above passed through to editor_command_line

Handling of nm-connection-editor command line arguments was changed in
f3782da2. Since that commit, most args are handled by `editor_command_line`,
but one (`--keep-above`) is handled by `main`. Unfortunately, if
`--keep-above` appears with other arguments, `main` does not strip it from
argv and parsing in `editor_command_line` fails with "Failed to parse

To handle this, let's just have `editor_command_line` recognize but ignore
`--keep-above` if it encounters it.

#1Signed-off-by: default avatarAdam Williamson <>
parent b5e496cc
Pipeline #14658 passed with stages
in 10 minutes and 58 seconds
......@@ -224,7 +224,7 @@ editor_command_line (GApplication *application,
GOptionContext *opt_ctx = NULL;
GError *error = NULL;
gs_free char *type = NULL, *uuid = NULL, *import = NULL;
gboolean create = FALSE, show = FALSE;
gboolean create = FALSE, show = FALSE, keepabove = FALSE;
int ret = 1;
GOptionEntry entries[] = {
{ "type", 't', 0, G_OPTION_ARG_STRING, &type, "Type of connection to show or create", NM_SETTING_WIRED_SETTING_NAME },
......@@ -232,6 +232,10 @@ editor_command_line (GApplication *application,
{ "show", 's', 0, G_OPTION_ARG_NONE, &show, "Show a given connection type page", NULL },
{ "edit", 'e', 0, G_OPTION_ARG_STRING, &uuid, "Edit an existing connection with a given UUID", "UUID" },
{ "import", 'i', 0, G_OPTION_ARG_STRING, &import, "Import a VPN connection from given file", NULL },
/* handled in main but may be passed through here, so we need
* to parse and ignore it
{ "keep-above", 0, G_OPTION_FLAG_HIDDEN, G_OPTION_ARG_NONE, &keepabove, NULL, NULL },
{ NULL }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment