summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2010-11-18 17:06:37 -0800
committerStig Thormodsrud <stig@vyatta.com>2010-11-18 17:06:37 -0800
commit1fbdde7b249136f9814d7ef820cbc2a8409b6ecd (patch)
tree303180ea15497dfc7ae07d731a328f3cac419e56 /src
parent1b346441e7612dee9985ef1e8c4a4292fbda90df (diff)
downloadvyatta-cfg-1fbdde7b249136f9814d7ef820cbc2a8409b6ecd.tar.gz
vyatta-cfg-1fbdde7b249136f9814d7ef820cbc2a8409b6ecd.zip
Add --show-working-only option to showCfg.
Diffstat (limited to 'src')
-rw-r--r--src/cli_shell_api.cpp8
1 files changed, 8 insertions, 0 deletions
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<string>& 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<string>& args);
@@ -400,12 +401,18 @@ showCfg(const vector<string>& args)
UnionfsCstore cstore(true);
vector<string> 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}
};