From efe44d60e84160c9fe2ad19d7a9fb30173e402fb Mon Sep 17 00:00:00 2001 From: Olof hagsand Date: Tue, 5 Mar 2019 16:19:20 +0100 Subject: [PATCH] Added base as CLI default mode and cli --- CHANGELOG.md | 1 + apps/cli/cli_plugin.c | 7 +++++-- apps/cli/clixon_cli_api.h | 2 +- example/example_cli.cli | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b652624..5d3eeee9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ ``` ### Minor changes +* Added "base" as CLI default mode and "cli> " as default prompt. * Removed obsolete `CLICON_CLI_MODEL_TREENAME_PATCH` * Added specific clixon_suberrno code: XMLPARSE_ERRNO to identify XML parse errors. * Removed all dependency on strverscmp diff --git a/apps/cli/cli_plugin.c b/apps/cli/cli_plugin.c index f0e38f39..19e438f1 100644 --- a/apps/cli/cli_plugin.c +++ b/apps/cli/cli_plugin.c @@ -282,8 +282,11 @@ cli_load_syntax(clicon_handle h, /* Make sure we have a syntax mode specified */ if (mode == NULL || strlen(mode) < 1) { /* may be null if not given in file */ - clicon_err(OE_PLUGIN, 0, "No syntax mode specified in %s", filepath); - goto done; + mode = clicon_cli_mode(h); + if (mode == NULL || strlen(mode) < 1) { /* may be null if not given in file */ + clicon_err(OE_PLUGIN, 0, "No syntax mode specified in %s", filepath); + goto done; + } } if ((vec = clicon_strsep(mode, ":", &nvec)) == NULL) goto done; diff --git a/apps/cli/clixon_cli_api.h b/apps/cli/clixon_cli_api.h index 0c95a093..5ed8f782 100644 --- a/apps/cli/clixon_cli_api.h +++ b/apps/cli/clixon_cli_api.h @@ -42,7 +42,7 @@ */ /* Max prompt length */ #define CLI_PROMPT_LEN 64 -#define CLI_DEFAULT_PROMPT ">" +#define CLI_DEFAULT_PROMPT "cli> " /* * Function Declarations diff --git a/example/example_cli.cli b/example/example_cli.cli index 5e1ab6c2..1b31ab30 100644 --- a/example/example_cli.cli +++ b/example/example_cli.cli @@ -29,7 +29,6 @@ copy("Copy and create a new object") { } discard("Discard edits (rollback 0)"), discard_changes(); compare("Compare running and candidate"), compare_dbs((int32)1); -compare("Compare running and candidate"), compare_dbs((int32)1); show("Show a particular state of the system"){ xpath("Show configuration") ("XPATH expression"), show_conf_xpath("candidate");