diff --git a/CHANGELOG.md b/CHANGELOG.md index b80ee968..4478ca3e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -157,6 +157,7 @@ ### Minor changes +* Added CLIgen tab-modes in config option CLICON_CLI_TAB_MODE, which means you can control the behaviour of `` in the CLI. * Yang state get improvements * 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. diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 57e7da65..f1ce87b2 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -541,6 +541,9 @@ main(int argc, char **argv) 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 on command line", cli_syntax_mode(h)); + /* CLIgen tab mode, ie how s behave */ + cligen_tabmode_set(cli_cligen(h), clicon_cli_tab_mode(h)); + if (logclisyntax) cli_logsyntax_set(h, logclisyntax); diff --git a/lib/clixon/clixon_options.h b/lib/clixon/clixon_options.h index c25e1f21..fbcdb09a 100644 --- a/lib/clixon/clixon_options.h +++ b/lib/clixon/clixon_options.h @@ -155,6 +155,9 @@ static inline char *clicon_clispec_dir(clicon_handle h){ static inline char *clicon_cli_mode(clicon_handle h){ 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){ return clicon_option_str(h, "CLICON_CLI_MODEL_TREENAME"); } diff --git a/yang/clixon/clixon-config@2019-03-05.yang b/yang/clixon/clixon-config@2019-03-05.yang index 1949a813..92bf3be5 100644 --- a/yang/clixon/clixon-config@2019-03-05.yang +++ b/yang/clixon/clixon-config@2019-03-05.yang @@ -316,7 +316,7 @@ module clixon-config { type string; default "datamodel"; description - "If CLICON_CLI_GENMODEL is set, CLI specs can reference the + "If set, CLI specs can reference the model syntax using this reference. Example: set @datamodel, cli_set();"; } @@ -346,6 +346,20 @@ module clixon-config { Set to 1 if you want CLI to scroll sideways when approaching 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: shows short info of available commands + 1: has same output as , ie line per command + bit 2: 0: On , select a command over a if both exist + 1: Commands and vars have same preference. + bit 3: 0: On , never complete more than one level per + 1: Complete all levels at once if possible. + "; + } leaf CLICON_CLI_UTF8 { type int8; default 0;