* CLI-spec variable CLICON_PROMPT %W changed semantics due to long prompt
* From "Full Working edit path" to "Last element of working path" * New `%w` has "Full working path"
This commit is contained in:
parent
f922211212
commit
519fe1f576
3 changed files with 24 additions and 3 deletions
|
|
@ -64,6 +64,9 @@ Planned: January, 2022
|
|||
|
||||
Users may have to change how they access the system
|
||||
|
||||
* CLI-spec variable `CLICON_PROMPT` `%W` changed semantics due to long prompt
|
||||
* From "Full Working edit path" to "Last element of working path"
|
||||
* New `%w` has "Full working path"
|
||||
* Auto-cli edit-modes changed
|
||||
* Edit modes only for list and container nodes
|
||||
* Change cli spec entry to `edit @datamodelmode, cli_auto_edit("basemodel");`
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ cli_load_syntax_file(clicon_handle h,
|
|||
fclose(f);
|
||||
/* Get CLICON specific global variables:
|
||||
* CLICON_MODE: which mode(s) this syntax applies to
|
||||
* CLICON_PROMPT: Cli prompt in this mode
|
||||
* CLICON_PROMPT: Cli prompt in this mode (see cli_prompt_get)
|
||||
* CLICON_PLUGIN: Name of C API plugin
|
||||
* Note: the base case is that it is:
|
||||
* (1) a single mode or
|
||||
|
|
@ -677,7 +677,25 @@ cli_prompt_get(clicon_handle h,
|
|||
strcpy(tty, "notty");
|
||||
cprintf(cb, "%s", tty);
|
||||
break;
|
||||
case 'W': /* working edit path */
|
||||
case 'W': /* Last element of working path */
|
||||
if (clicon_data_get(h, "cli-edit-mode", &path) == 0 &&
|
||||
strlen(path)){
|
||||
int i;
|
||||
|
||||
for (i=strlen(path)-1; i>=0; i--)
|
||||
if (path[i] == '/' || path[i] == ':')
|
||||
/* see yang2api_path_fmt_1() why occasional trailing / */
|
||||
if (i < strlen(path)-1)
|
||||
break;
|
||||
if (i >= 0)
|
||||
cprintf(cb, "%s", &path[i+1]);
|
||||
else
|
||||
cprintf(cb, "%s", path);
|
||||
}
|
||||
else
|
||||
cprintf(cb, "/");
|
||||
break;
|
||||
case 'w': /* Full Working edit path */
|
||||
if (clicon_data_get(h, "cli-edit-mode", &path) == 0 &&
|
||||
strlen(path))
|
||||
cprintf(cb, "%s", path);
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ EOF
|
|||
|
||||
cat <<EOF > $fspec
|
||||
CLICON_MODE="example";
|
||||
CLICON_PROMPT="%U@%H %W> ";
|
||||
CLICON_PROMPT="%U@%H %w> ";
|
||||
CLICON_PLUGIN="example_cli";
|
||||
|
||||
# Autocli syntax tree operations
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue