From 1fbdde7b249136f9814d7ef820cbc2a8409b6ecd Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Thu, 18 Nov 2010 17:06:37 -0800 Subject: Add --show-working-only option to showCfg. --- src/cli_shell_api.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src') diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp index cdad473..02340bf 100644 --- a/src/cli_shell_api.cpp +++ b/src/cli_shell_api.cpp @@ -53,6 +53,7 @@ print_vec(const vector& vec, const char *sep, const char *quote) int op_show_active_only = 0; int op_show_show_defaults = 0; int op_show_hide_secrets = 0; +int op_show_working_only = 0; typedef void (*OpFuncT)(const vector& args); @@ -400,12 +401,18 @@ showCfg(const vector& args) UnionfsCstore cstore(true); vector nargs(args); bool active_only = (!cstore.inSession() || op_show_active_only); + bool working_only = (cstore.inSession() && op_show_working_only); cnode::CfgNode aroot(cstore, nargs, true, true); if (active_only) { // just show the active config cnode::show_diff(aroot, aroot, op_show_show_defaults, op_show_hide_secrets); + } else if (working_only) { + // just show the working config without diff markers + cnode::CfgNode wroot(cstore, nargs, false, true); + cnode::show_diff(wroot, wroot, op_show_show_defaults, + op_show_hide_secrets); } else { cnode::CfgNode wroot(cstore, nargs, false, true); cnode::show_diff(aroot, wroot, op_show_show_defaults, @@ -469,6 +476,7 @@ struct option options[] = { {"show-active-only", no_argument, &op_show_active_only, 1}, {"show-show-defaults", no_argument, &op_show_show_defaults, 1}, {"show-hide-secrets", no_argument, &op_show_hide_secrets, 1}, + {"show-working-only", no_argument, &op_show_working_only, 1}, {NULL, 0, NULL, 0} }; -- cgit v1.2.3