diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28d1fa9f..fd173d97 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -78,6 +78,7 @@ Users may have to change how they access the system
### Corrected Bugs
+* Fixed: [Duplicate lines emitted by cli_show_config (cli output style) when yang list element has composite key](https://github.com/clicon/clixon/issues/258)
* Fixed: [JSON leaf-list output single element leaf-list does not use array](https://github.com/clicon/clixon/issues/261)
* Fixed: Netconf diff callback did not work with choice and same value replace
* Eg if YANG is `choice c { leaf x; leaf y }` and XML changed from `42` to `42` the datastrore changed, but was not detected by diff algorithms and provided to validate callbacks.
diff --git a/apps/cli/cli_auto.c b/apps/cli/cli_auto.c
index a76e38d4..fe33128a 100644
--- a/apps/cli/cli_auto.c
+++ b/apps/cli/cli_auto.c
@@ -407,16 +407,17 @@ cli_xml2cli(cxobj *xn,
(*fn)(stdout, "\n");
}
+ /* For lists, print cbpre before its elements */
+ if (yang_keyword_get(ys) == Y_LIST)
+ (*fn)(stdout, "%s\n", cbuf_get(cbpre));
/* Then loop through all other (non-keys) */
xe = NULL;
while ((xe = xml_child_each(xn, xe, -1)) != NULL){
if (yang_keyword_get(ys) == Y_LIST){
if ((match = yang_key_match(ys, xml_name(xe))) < 0)
goto done;
- if (match){
- (*fn)(stdout, "%s\n", cbuf_get(cbpre));
+ if (match)
continue; /* Not key itself */
- }
}
if (cli_xml2cli(xe, cbuf_get(cbpre), gt, fn) < 0)
goto done;