Added final \n to JSON pretty-print output
This was a correction of fix to: [CLI Show config JSON with multiple top-level elements is broken](https://github.com/clicon/clixon/issues/381)
This commit is contained in:
parent
83f71529d7
commit
c93f264215
2 changed files with 1 additions and 14 deletions
|
|
@ -436,8 +436,6 @@ cli_show_common(clicon_handle h,
|
|||
cxobj **vec = NULL;
|
||||
size_t veclen;
|
||||
cxobj *xp;
|
||||
yang_stmt *yp;
|
||||
enum rfc_6020 ys_keyword;
|
||||
int i;
|
||||
|
||||
if (state && strcmp(db, "running") != 0){
|
||||
|
|
@ -471,11 +469,6 @@ cli_show_common(clicon_handle h,
|
|||
if (xpath_vec(xt, nsc, "%s", &vec, &veclen, xpath) < 0)
|
||||
goto done;
|
||||
if (veclen){
|
||||
xp = vec[0]; /* First peek to see if it is special case yang list */
|
||||
if ((yp = xml_spec(xp)) != NULL)
|
||||
ys_keyword = yang_keyword_get(xml_spec(xp));
|
||||
else
|
||||
ys_keyword = 0;
|
||||
/* Special case LIST */
|
||||
if (format == FORMAT_JSON){
|
||||
switch (format){
|
||||
|
|
@ -490,10 +483,6 @@ cli_show_common(clicon_handle h,
|
|||
else /* Default */
|
||||
for (i=0; i<veclen; i++){
|
||||
xp = vec[i];
|
||||
if ((yp = xml_spec(xp)) != NULL)
|
||||
ys_keyword = yang_keyword_get(xml_spec(xp));
|
||||
else
|
||||
ys_keyword = 0;
|
||||
/* Print configuration according to format */
|
||||
switch (format){
|
||||
case FORMAT_XML:
|
||||
|
|
|
|||
|
|
@ -1344,9 +1344,7 @@ xml2json_vec(FILE *f,
|
|||
}
|
||||
if (xml2json_cbuf_vec(cb, vec, veclen, pretty, skiptop) < 0)
|
||||
goto done;
|
||||
fprintf(f, "%s", cbuf_get(cb));
|
||||
if (!pretty)
|
||||
fprintf(f, "\n");
|
||||
fprintf(f, "%s\n", cbuf_get(cb));
|
||||
retval = 0;
|
||||
done:
|
||||
if (cb)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue