diff options
author | Daniil Baturin <daniil@baturin.org> | 2024-05-27 14:47:03 +0100 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2024-05-27 14:47:03 +0100 |
commit | 694e122775613d13b42db9d02ae7bb1a1853c3f5 (patch) | |
tree | fe1f7829fa64352d64379c8716e415dbbb44546d /etc | |
parent | ecc7310a9642618c67acf5551eb6aef740313571 (diff) | |
download | vyatta-cfg-694e122775613d13b42db9d02ae7bb1a1853c3f5.tar.gz vyatta-cfg-694e122775613d13b42db9d02ae7bb1a1853c3f5.zip |
cli: T6383: improve completion help for rollback commands
Diffstat (limited to 'etc')
-rw-r--r-- | etc/bash_completion.d/vyatta-cfg | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/etc/bash_completion.d/vyatta-cfg b/etc/bash_completion.d/vyatta-cfg index c2d3a42..6274e1c 100644 --- a/etc/bash_completion.d/vyatta-cfg +++ b/etc/bash_completion.d/vyatta-cfg @@ -253,7 +253,40 @@ vyatta_rollback_complete () if [ $COMP_CWORD -eq 1 -a -z "${COMP_WORDS[1]}" ]; then echo echo "Possible completions:" - echo -e " <N>\tRollback to revision N (currently requires reboot)" + echo -e " <N>\tRollback to revision N (requires reboot)" + echo -e " \t(use rollback-soft for a non-disruptive rollback) + 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_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" + echo -e " \t(applies a diff that you can compare and commit)" echo -e "\n Revisions:" print_commit_log COMPREPLY=( "" " " ) |