CLI show compare example function

Improved diff algorithm for XML and TEXT/curly, replaced UNIX diff with structural in-mem algorithm
Fixed: ["show compare" and "show compare | display cli" differs #23](https://github.com/clicon/clixon-controller/issues/23)
Changed parameters of example clispec function `compare_dbs()`
Added show2cbuf functions for TEXT/CLI
Renamed clixon_txt2file to clixon_text2file
This commit is contained in:
Olof hagsand 2023-09-22 10:26:09 +02:00
parent 45f41e3e4d
commit 2603b6f139
19 changed files with 1170 additions and 193 deletions

View file

@ -129,9 +129,9 @@ debug("Debugging parts of the system"){
}
show("Show a particular state of the system"){
xpath("Show configuration") <xpath:string>("XPATH expression") <ns:string>("Namespace"), show_conf_xpath("candidate");
compare("Compare candidate and running databases"), compare_dbs((int32)0);{
xml("Show comparison in xml"), compare_dbs((int32)0);
text("Show comparison in text"), compare_dbs((int32)1);
compare("Compare candidate and running databases"), compare_dbs("running", "candidate", "xml");{
xml("Show comparison in xml"), compare_dbs("running", "candidate", "xml");
text("Show comparison in text"), compare_dbs("running", "candidate", "text");
}
configuration("Show configuration"), cli_show_auto_mode("candidate", "text", true, false);{
cli("Show configuration as CLI commands"), cli_show_auto_mode("candidate", "cli", true, false, "report-all", "set ");
@ -229,7 +229,7 @@ new "cli success validate"
expectpart "$($clixon_cli -1 -f $cfg -l o validate)" 0 "^$"
new "cli compare diff"
expectpart "$($clixon_cli -1 -f $cfg -l o show compare text)" 0 "+ address 1.2.3.4"
expectpart "$($clixon_cli -1 -f $cfg -l o show compare text)" 0 "+\ *address 1.2.3.4"
new "cli start shell"
expectpart "$($clixon_cli -1 -f $cfg -l o shell echo foo)" 0 "foo"