* 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
This commit is contained in:
Olof hagsand 2020-09-04 13:15:53 +02:00
parent 81fc7f742b
commit b8955c81d8
4 changed files with 52 additions and 18 deletions

View file

@ -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);