klinfix: restore Ctrl-C to abort current line, use Ctrl-D instead

While spending the past couple of weeks actually trying to use the CLI,
I realized that it was very confusing to have a different behavior for
Ctrl-C than I was used to from regular shells (including the old clish
from $OLDJOB).

This change drops the Ctrl-C binding, restoring break/abort behavior,
and lets Ctrl-D be abort/exit.  Pressing Ctrl-D in a sub-context in
configure calls exit, when in the top-most configure context we now
do an abort and return to admin-exec.

To apply the changes the user still has to type 'commit' or 'leave',
or tap Ctrl-Z as in the Cisco CLI.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2023-08-08 16:35:18 +02:00
committed by Tobias Waldekranz
parent d913ce00e6
commit 63aa130e9c
+9 -10
View File
@@ -292,32 +292,31 @@
<ACTION sym="prompt" exec_on="always">%u@%h:configure> </ACTION>
</PROMPT>
<HOTKEY key="^C" cmd="up"/>
<HOTKEY key="^D" cmd="abort"/>
<HOTKEY key="^D" cmd="exit"/>
<HOTKEY key="^Z" cmd="leave"/>
<!-- Move -->
<COMMAND name="abort" help="Abandon changes made candidate">
<COMMAND name="abort" help="Abort changes in candidate and return to admin-exec">
<ACTION sym="srp_reset@sysrepo"/>
<ACTION sym="nav">replace main</ACTION>
</COMMAND>
<COMMAND name="leave" help="Finalize candidate and apply to running-config">
<COMMAND name="leave" help="Apply candidate to running-config and return to admin-exec">
<ACTION sym="klix_commit@klinfix"/>
<ACTION sym="nav" exec_on="success">replace main</ACTION>
</COMMAND>
<COMMAND name="exit" help="Ascend to the parent configuration node, or abort (from top)">
<ACTION sym="srp_up@sysrepo"/>
<ACTION sym="klix_commit@klinfix" exec_on="fail"/>
<ACTION sym="nav" exec_on="success">replace main</ACTION>
</COMMAND>
<COMMAND name="up" help="Ascend to the parent configuration node">
<ACTION sym="srp_up@sysrepo"/>
</COMMAND>
<COMMAND name="exit" help="Ascend to parent configuration node, or abort (from top)">
<ACTION sym="srp_up@sysrepo"/>
<ACTION sym="srp_reset@sysrepo" exec_on="fail" update_retcode="false"/>
<ACTION sym="nav" exec_on="fail">replace main</ACTION>
</COMMAND>
<COMMAND name="top" help="Ascend to the configuration root">
<ACTION sym="srp_top@sysrepo"/>
</COMMAND>