diff options
author | An-Cheng Huang <ancheng@vyatta.com> | 2010-11-10 14:08:51 -0800 |
---|---|---|
committer | An-Cheng Huang <ancheng@vyatta.com> | 2010-11-10 14:08:51 -0800 |
commit | 5a0e77fe4729bd9df3339c1d85efefdfc8ef1cbb (patch) | |
tree | 2272c5abc545fcfd13580529a02e820440bd5d75 /src/cli_shell_api.cpp | |
parent | 51d0de81c63be3d0768fffe21955d2997de67c32 (diff) | |
download | vyatta-cfg-5a0e77fe4729bd9df3339c1d85efefdfc8ef1cbb.tar.gz vyatta-cfg-5a0e77fe4729bd9df3339c1d85efefdfc8ef1cbb.zip |
switch to new output framework
* change showCfg to use new code.
* remove old files.
Diffstat (limited to 'src/cli_shell_api.cpp')
-rw-r--r-- | src/cli_shell_api.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/src/cli_shell_api.cpp b/src/cli_shell_api.cpp index 0038866..cdad473 100644 --- a/src/cli_shell_api.cpp +++ b/src/cli_shell_api.cpp @@ -22,7 +22,8 @@ #include <cli_cstore.h> #include <cstore/unionfs/cstore-unionfs.hpp> -#include <cstore/cstore-node.hpp> +#include <cnode/cnode.hpp> +#include <cnode/cnode-algorithm.hpp> /* This program provides an API for shell scripts (e.g., snippets in * templates, standalone scripts, etc.) to access the CLI cstore library. @@ -398,8 +399,18 @@ showCfg(const vector<string>& args) { UnionfsCstore cstore(true); vector<string> nargs(args); - CstoreCfgNode root(cstore, nargs, op_show_active_only); - root.show_as_root(op_show_show_defaults, op_show_hide_secrets); + bool active_only = (!cstore.inSession() || op_show_active_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 { + cnode::CfgNode wroot(cstore, nargs, false, true); + cnode::show_diff(aroot, wroot, op_show_show_defaults, + op_show_hide_secrets); + } } #define OP(name, exact, exact_err, min, min_err) \ |