CLI: Added meta format pipe-xml-default for cli commands inside pipes

This commit is contained in:
Olof hagsand 2024-12-09 22:52:23 +01:00
parent c24c38dbb5
commit 2790d243e1
5 changed files with 21 additions and 294 deletions

View file

@ -870,6 +870,13 @@ cli_show_option_format(clixon_handle h,
clixon_err(OE_PLUGIN, 0, "Not valid format: %s", formatstr);
goto done;
}
/* Special pipe xml default handling */
if (format == FORMAT_PIPE_XML_DEFAULT){
if (cligen_spipe_get(cli_cligen(h)) != -1)
format = FORMAT_XML;
else
format = FORMAT_DEFAULT;
}
/* Special default format handling */
if (format == FORMAT_DEFAULT){
formatstr = clicon_option_str(h, "CLICON_CLI_OUTPUT_FORMAT");
@ -877,6 +884,10 @@ cli_show_option_format(clixon_handle h,
clixon_err(OE_PLUGIN, 0, "Not valid format: %s", formatstr);
goto done;
}
if (format > FORMAT_NETCONF){
clixon_err(OE_PLUGIN, 0, "Not concrete format: %d", format);
goto done;
}
}
*formatp = format;
retval = 0;