Page MenuHomeVyOS Platform

vyatta-cfg-separate-completer.diff

Authored By
talmakion
May 25 2024, 5:43 AM
Size
1 KB
Referenced Files
None
Subscribers
None

vyatta-cfg-separate-completer.diff

diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg
index c2d3a42..5c8af9a 100644
--- a/etc/bash_completion.d/vyatta-cfg
+++ b/etc/bash_completion.d/vyatta-cfg
@@ -266,6 +266,37 @@ vyatta_rollback_complete ()
eval $restore_shopts
}
+vyatta_rollback-soft_complete ()
+{
+ # Generate completion help for the "rollback-soft" command
+
+ local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
+ shopt -s extglob nullglob
+
+ if [[ $COMP_CWORD -eq 0 ]];then
+ vyatta_config_complete "$@"
+ eval $restore_shopts
+ return
+ fi
+
+ # Only provide completions after command name has been typed, but
+ # before any characters of the command argument have been entered.
+ if [ $COMP_CWORD -eq 1 -a -z "${COMP_WORDS[1]}" ]; then
+ echo
+ echo "Possible completions:"
+ echo -e " <N>\tRollback to revision N (as an uncommitted change)"
+ echo -e "\n Revisions:"
+ print_commit_log
+ COMPREPLY=( "" " " )
+ else
+ echo -en "\nPossible completions:\n"
+ echo -en " <Enter>\tExecute the current command"
+ COMPREPLY=( "" " " )
+ fi
+
+ eval $restore_shopts
+}
+
vyatta_compare_complete ()
{
# Generate completion help for the "compare" command
diff --git a/functions/interpreter/vyatta-cfg-run b/functions/interpreter/vyatta-cfg-run
index a13c62d..d1dbd51 100644
--- a/functions/interpreter/vyatta-cfg-run
+++ b/functions/interpreter/vyatta-cfg-run
@@ -627,7 +627,7 @@ _vyatta_cfg_init ()
rollback)
complete -F vyatta_rollback_complete ${cmd:0:$pos} ;;
rollback-soft)
- complete -F vyatta_rollback_complete ${cmd:0:$pos} ;;
+ complete -F vyatta_rollback-soft_complete ${cmd:0:$pos} ;;
commit|commit-confirm)
complete -F vyatta_commit_complete ${cmd:0:$pos} ;;
*)

File Metadata

Mime Type
text/x-diff
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
503536
Default Alt Text
vyatta-cfg-separate-completer.diff (1 KB)

Event Timeline