diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6472086d..8fd15856 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -40,12 +40,24 @@ Users may have to change how they access the system
* The fix of [Cannot create or modify NACM data node access rule with path using JSON encoding #129](https://github.com/clicon/clixon/issues/129) leads that data-node paths, eg `...ex:table/ex:parameter` instance-identifiers are restricted to canonical namespace identifiers for both XML and JSON encoding. That is, if a symbol (such as `table` above) is a symbol in a module with prefix `ex`, another prefix cannot be used, even though defined with a `xmlns:` rule.
* New clixon-config@2020-08-17.yang revision
- * Added options for Restconf evhtp setting default bind socket address and ports `CLICON_RESTCONF_IPV4_ADDR`, `CLICON_RESTCONF_IPV6_ADDR`, `CLICON_RESTCONF_HTTP_PORT`, `CLICON_RESTCONF_HTTPS_PORT`, `CLICON_NAMESPACE_NETCONF_DEFAULT`
+ * Added options for Restconf evhtp setting default bind socket address and ports:
+ * `CLICON_RESTCONF_IPV4_ADDR`, `CLICON_RESTCONF_IPV6_ADDR`, `CLICON_RESTCONF_HTTP_PORT`, `CLICON_RESTCONF_HTTPS_PORT`
+ * Added option for using NETCONF default namespace: `CLICON_NAMESPACE_NETCONF_DEFAULT`
+ * Added options for better handling of long and multi-line CLI help strings:
+ * `CLICON_CLI_HELPSTRING_TRUNCATE`, `CLICON_CLI_HELPSTRING_LINES`
### C/CLI-API changes on existing features
Developers may need to change their code
+### Minor changes
+
+* Changed CLI help strings behaviour on query (?) for long and multi-line help strings.
+ * If multiple strings (eg "\n" in text), indent before each new line
+ * Primarily for auto-cli where long help strings are generated from YANG descriptions, but applies as well for manual long/multi-line help strings
+ * New config option: `CLICON_CLI_HELPSTRING_TRUNCATE`: Truncate help string on right margin mode
+ * New config option: `CLICON_CLI_HELPSTRING_LINES`: Limit of number of help strings to show
+
### Corrected Bugs
* Fixed: [CLI crash if error-info is empty #134](https://github.com/clicon/clixon/issues/134)
diff --git a/apps/cli/cli_common.c b/apps/cli/cli_common.c
index 89755ff9..27425311 100644
--- a/apps/cli/cli_common.c
+++ b/apps/cli/cli_common.c
@@ -1317,5 +1317,5 @@ cli_help(clicon_handle h, cvec *vars, cvec *argv)
parse_tree *pt;
pt = cligen_tree_active_get(ch);
- return cligen_help(stdout, pt);
+ return cligen_help(ch, stdout, pt);
}
diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c
index f335a18f..fe58b9e0 100644
--- a/apps/cli/cli_main.c
+++ b/apps/cli/cli_main.c
@@ -392,6 +392,7 @@ main(int argc,
size_t cligen_buflen;
size_t cligen_bufthreshold;
int dbg=0;
+ int nr;
/* Defaults */
once = 0;
@@ -560,9 +561,8 @@ main(int argc,
/* Init row numbers for raw terminals */
if (clicon_option_exists(h, "CLICON_CLI_LINES_DEFAULT")){
- int rows;
- rows = clicon_option_int(h, "CLICON_CLI_LINES_DEFAULT");
- cligen_terminal_rows_set(cli_cligen(h), rows);
+ nr = clicon_option_int(h, "CLICON_CLI_LINES_DEFAULT");
+ cligen_terminal_rows_set(cli_cligen(h), nr);
}
if (clicon_yang_regexp(h) == REGEXP_LIBXML2){
@@ -575,6 +575,12 @@ main(int argc,
#endif
}
+ /* CLIgen help string setting for long and multi-line strings */
+ nr = clicon_option_int(h, "CLICON_CLI_HELPSTRING_TRUNCATE");
+ cligen_helpstring_truncate_set(cli_cligen(h), nr);
+ nr = clicon_option_int(h, "CLICON_CLI_HELPSTRING_LINES");
+ cligen_helpstring_lines_set(cli_cligen(h), nr);
+
/* Setup signal handlers */
cli_signal_init(h);
diff --git a/yang/clixon/clixon-config@2020-08-17.yang b/yang/clixon/clixon-config@2020-08-17.yang
index 892eea70..fc32ac79 100644
--- a/yang/clixon/clixon-config@2020-08-17.yang
+++ b/yang/clixon/clixon-config@2020-08-17.yang
@@ -46,7 +46,8 @@ module clixon-config {
description
"Added: CLICON_RESTCONF_IPV4_ADDR, CLICON_RESTCONF_IPV6_ADDR,
CLICON_RESTCONF_HTTP_PORT, CLICON_RESTCONF_HTTPS_PORT
- CLICON_NAMESPACE_NETCONF_DEFAULT";
+ CLICON_NAMESPACE_NETCONF_DEFAULT,
+ CLICON_CLI_HELPSTRING_TRUNCATE, CLICON_CLI_HELPSTRING_LINES";
}
revision 2020-06-17 {
description
@@ -585,6 +586,22 @@ module clixon-config {
If 0, the growth continues with quadratic growth.
See CLICON_CLI_BUF_THRESHOLD";
}
+ leaf CLICON_CLI_HELPSTRING_TRUNCATE {
+ type boolean;
+ default false;
+ description
+ "CLIgen help string on query (?): Truncate help string on right margin mode
+ This only applies if you have long help strings, such as when generating them from a
+ spec such as the autocli";
+ }
+ leaf CLICON_CLI_HELPSTRING_LINES {
+ type int32;
+ default 0;
+ description
+ "CLIgen help string on query (?) limit of number of lines to show, 0 means unlimited.
+ This only applies if you have multi-line help strings, such as when generating
+ from a spec, such as in the autocli.";
+ }
leaf CLICON_SOCK_FAMILY {
type string;
default "UNIX";
@@ -712,6 +729,17 @@ module clixon-config {
lists, therefore it is recommended to enable it during development and debugging
but disable it in production, until this has been resolved.";
}
+ leaf CLICON_NAMESPACE_NETCONF_DEFAULT {
+ type boolean;
+ default false;
+ description
+ "Undefine if you want to ensure strict namespace assignment on all netconf
+ and XML statements according to the standard RFC 6241.
+ If defined, top-level rpc calls need not have namespaces (eg using xmlns=)
+ since the default NETCONF namespace will be assumed. (This is not standard).
+ See rfc6241 3.1: urn:ietf:params:xml:ns:netconf:base:1.0.";
+
+ }
leaf CLICON_STARTUP_MODE {
type startup_mode;
description "Which method to boot/start clicon backend";
@@ -836,17 +864,5 @@ module clixon-config {
data to store before dropping. 0 means no retention";
}
- leaf CLICON_NAMESPACE_NETCONF_DEFAULT {
- type boolean;
- default false;
- description
- "Undefine if you want to ensure strict namespace assignment on all netconf
- and XML statements according to the standard RFC 6241.
- If defined, top-level rpc calls need not have namespaces (eg using xmlns=)
- since the default NETCONF namespace will be assumed. (This is not standard).
- See rfc6241 3.1: urn:ietf:params:xml:ns:netconf:base:1.0.";
-
- }
}
-
}