cli: merge editor_show_secrets with NmcConfig.show_secrets

The show-secrets flag can be toggled in edit mode

  nmcli> nmcli show-secrets yes

There is no point in tracking two separate flags for it. Inside
edit mode, when the user toggles the show-secrets flag, it should
overwrite the command line option.

These two flags can be merged.
This commit is contained in:
Thomas Haller 2017-04-06 15:27:56 +02:00
parent f0d91455ca
commit fdd758112f
3 changed files with 5 additions and 7 deletions

View file

@ -5969,7 +5969,7 @@ editor_show_connection (NMConnection *connection, NmCli *nmc)
nmc->nmc_config_mutable.multiline_output = TRUE;
nmc->nmc_config_mutable.escape_values = 0;
nmc_connection_profile_details (connection, nmc, nmc->editor_show_secrets);
nmc_connection_profile_details (connection, nmc, nmc->nmc_config.show_secrets);
}
static void
@ -5982,7 +5982,7 @@ editor_show_setting (NMSetting *setting, NmCli *nmc)
nmc->nmc_config_mutable.multiline_output = TRUE;
nmc->nmc_config_mutable.escape_values = 0;
setting_details (&nmc->nmc_config, setting, NULL, nmc->editor_show_secrets);
setting_details (&nmc->nmc_config, setting, NULL, nmc->nmc_config.show_secrets);
}
typedef enum {
@ -7646,7 +7646,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
g_print (_("Error: show-secrets: %s\n"), tmp_err->message);
g_clear_error (&tmp_err);
} else
nmc->editor_show_secrets = bb;
nmc->nmc_config_mutable.show_secrets = bb;
} else if (cmd_arg_p && matches (cmd_arg_p, "prompt-color")) {
GError *tmp_err = NULL;
NMMetaTermColor color;
@ -7673,7 +7673,7 @@ editor_menu_main (NmCli *nmc, NMConnection *connection, const char *connection_t
"prompt-color: %d\n",
nmc->editor_status_line ? "yes" : "no",
nmc->editor_save_confirmation ? "yes" : "no",
nmc->editor_show_secrets ? "yes" : "no",
nmc->nmc_config.show_secrets ? "yes" : "no",
nmc->editor_prompt_color);
} else
g_print (_("Invalid configuration option '%s'; allowed [%s]\n"),

View file

@ -543,7 +543,6 @@ nmc_init (NmCli *nmc)
nmc->nmc_config_mutable.in_editor = FALSE;
nmc->editor_status_line = FALSE;
nmc->editor_save_confirmation = TRUE;
nmc->editor_show_secrets = FALSE;
nmc->editor_prompt_color = NM_META_TERM_COLOR_NORMAL;
}

View file

@ -146,8 +146,7 @@ typedef struct _NmCli {
gboolean complete; /* Autocomplete the command line */
gboolean editor_status_line; /* Whether to display status line in connection editor */
gboolean editor_save_confirmation; /* Whether to ask for confirmation on saving connections with 'autoconnect=yes' */
gboolean editor_show_secrets; /* Whether to display secrets in the editor' */
NMMetaTermColor editor_prompt_color; /* Color of prompt in connection editor */
NMMetaTermColor editor_prompt_color; /* Color of prompt in connection editor */
} NmCli;
extern NmCli nm_cli;