From fdd758112f19a0e29bd1540604d36c1ffe2de1c1 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 6 Apr 2017 15:27:56 +0200 Subject: [PATCH] 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. --- clients/cli/connections.c | 8 ++++---- clients/cli/nmcli.c | 1 - clients/cli/nmcli.h | 3 +-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/clients/cli/connections.c b/clients/cli/connections.c index 5199fbcf89..ff8c4e97a5 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -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"), diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index a341940e32..2d224cf777 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -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; } diff --git a/clients/cli/nmcli.h b/clients/cli/nmcli.h index 1beaf74353..3e73e5105c 100644 --- a/clients/cli/nmcli.h +++ b/clients/cli/nmcli.h @@ -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;