Added CLIgen tab-modes in config option CLICON_CLI_TAB_MODE, which means you can control the behaviour of <tab> in the CLI.

This commit is contained in:
Olof hagsand 2019-05-29 20:11:31 +02:00
parent 0ef704563b
commit 55f9b7cab0
4 changed files with 22 additions and 1 deletions

View file

@ -157,6 +157,7 @@
### Minor changes ### Minor changes
* Added CLIgen tab-modes in config option CLICON_CLI_TAB_MODE, which means you can control the behaviour of `<tab>` in the CLI.
* Yang state get improvements * Yang state get improvements
* Integrated state and config into same tree on retrieval, not separate trees * Integrated state and config into same tree on retrieval, not separate trees
* Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info. * Added cli functions `cli_show_config_state()` and `cli_show_auto_state()` for showing combined config and state info.

View file

@ -541,6 +541,9 @@ main(int argc, char **argv)
if (cligen_tree_find(cli_cligen(h), cli_syntax_mode(h)) == NULL) if (cligen_tree_find(cli_cligen(h), cli_syntax_mode(h)) == NULL)
clicon_log(LOG_WARNING, "No such cli mode: %s (Specify cli mode with CLICON_CLI_MODE in config file or -m <mode> on command line", cli_syntax_mode(h)); clicon_log(LOG_WARNING, "No such cli mode: %s (Specify cli mode with CLICON_CLI_MODE in config file or -m <mode> on command line", cli_syntax_mode(h));
/* CLIgen tab mode, ie how <tab>s behave */
cligen_tabmode_set(cli_cligen(h), clicon_cli_tab_mode(h));
if (logclisyntax) if (logclisyntax)
cli_logsyntax_set(h, logclisyntax); cli_logsyntax_set(h, logclisyntax);

View file

@ -155,6 +155,9 @@ static inline char *clicon_clispec_dir(clicon_handle h){
static inline char *clicon_cli_mode(clicon_handle h){ static inline char *clicon_cli_mode(clicon_handle h){
return clicon_option_str(h, "CLICON_CLI_MODE"); return clicon_option_str(h, "CLICON_CLI_MODE");
} }
static inline int clicon_cli_tab_mode(clicon_handle h){
return clicon_option_int(h, "CLICON_CLI_TAB_MODE");
}
static inline char *clicon_cli_model_treename(clicon_handle h){ static inline char *clicon_cli_model_treename(clicon_handle h){
return clicon_option_str(h, "CLICON_CLI_MODEL_TREENAME"); return clicon_option_str(h, "CLICON_CLI_MODEL_TREENAME");
} }

View file

@ -316,7 +316,7 @@ module clixon-config {
type string; type string;
default "datamodel"; default "datamodel";
description description
"If CLICON_CLI_GENMODEL is set, CLI specs can reference the "If set, CLI specs can reference the
model syntax using this reference. model syntax using this reference.
Example: set @datamodel, cli_set();"; Example: set @datamodel, cli_set();";
} }
@ -346,6 +346,20 @@ module clixon-config {
Set to 1 if you want CLI to scroll sideways when approaching Set to 1 if you want CLI to scroll sideways when approaching
right margin"; right margin";
} }
leaf CLICON_CLI_TAB_MODE {
type int8;
default 0;
description
"Set CLI tab mode. This is actually a bitfield of three
combinations:
bit 1: 0: <tab> shows short info of available commands
1: <tab> has same output as <?>, ie line per command
bit 2: 0: On <tab>, select a command over a <var> if both exist
1: Commands and vars have same preference.
bit 3: 0: On <tab>, never complete more than one level per <tab>
1: Complete all levels at once if possible.
";
}
leaf CLICON_CLI_UTF8 { leaf CLICON_CLI_UTF8 {
type int8; type int8;
default 0; default 0;