diff --git a/lib/src/clixon_json.c b/lib/src/clixon_json.c index a72ee37d..8358d630 100644 --- a/lib/src/clixon_json.c +++ b/lib/src/clixon_json.c @@ -1239,7 +1239,12 @@ xml2json_cbuf_vec(cbuf *cb, if (xml2json1_cbuf(cb, xp, NO_ARRAY, - level+1, pretty, +#if 1 + level, +#else + level+1, +#endif + pretty, 1, NULL, NULL) < 0) goto done; diff --git a/test/test_autocli_show.sh b/test/test_autocli_show.sh index d64eefff..cd48167a 100755 --- a/test/test_autocli_show.sh +++ b/test/test_autocli_show.sh @@ -1,6 +1,9 @@ #!/usr/bin/env bash # Autocli show tests # Go through all formats and show for all formats +# Formats: XML, JSON, TEXT, CLI, NETCONF +# Pretty-print: false, true XXXX: align spaces +# API: cli_show_auto_mode(), cli_show_auto(), cli_show_config() XXX # Magic line must be first in script (see README.md) s="$_" ; . ./lib.sh || if [ "$s" = $0 ]; then exit 0; else return 0; fi @@ -83,9 +86,18 @@ quit("Quit"), cli_quit(); discard("Discard edits (rollback 0)"), discard_changes(); show("Show a particular state of the system"){ configuration("Show configuration"){ - xml("Show configuration as XML"), cli_show_auto_mode("candidate", "xml", false, false); - json("Show configuration as JSON"), cli_show_auto_mode("candidate", "json", false, false); - text("Show configuration as TEXT"), cli_show_auto_mode("candidate", "text", false, false); + xml("Show configuration as XML"), cli_show_auto_mode("candidate", "xml", false, false);{ + pretty-print, cli_show_auto_mode("candidate", "xml", true, false); + config, cli_show_config("candidate", "xml", "/", NULL, false, false); + } + json("Show configuration as JSON"), cli_show_auto_mode("candidate", "json", false, false);{ + pretty-print, cli_show_auto_mode("candidate", "json", true, false); + config, cli_show_config("candidate", "json", "/", NULL, false, false); + } + text("Show configuration as TEXT"), cli_show_auto_mode("candidate", "text", false, false);{ + pretty-print, cli_show_auto_mode("candidate", "text", true, false); + config, cli_show_config("candidate", "text", "/", NULL, false, false); + } cli("Show configuration as CLI commands"), cli_show_auto_mode("candidate", "cli", false, false, NULL, "set "); netconf("Show configuration as NETCONF"), cli_show_auto_mode("candidate", "netconf", false, false); } @@ -141,6 +153,12 @@ new "cli check show config $format" X='