From d36d0a6ea76d443c5e4072401eaa9dbf563c74bd Mon Sep 17 00:00:00 2001 From: Michael Larson Date: Fri, 14 May 2010 13:47:21 -0700 Subject: initial checkin of comment feature for cli. /* to create a comment */ > comment [PATH-TO-NODE] "my comments" /* to delete a comment */ > comment [PATH-TO-NODE] "" --- etc/bash_completion.d/20vyatta-cfg | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'etc') diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg index e17fd36..62a5440 100755 --- a/etc/bash_completion.d/20vyatta-cfg +++ b/etc/bash_completion.d/20vyatta-cfg @@ -431,6 +431,17 @@ loadkey() eval "${vyatta_sbindir}/vyatta-load-user-key.pl $@" } +comment() +{ + if [ "$#" -eq "0" ]; then + return 0 + fi + args=("$@") + #now need to replace last element + args[${#args[*]}-1]="\"${args[${#args[*]}-1]i}\""; + eval "${vyatta_sbindir}/vyatta-comment-config.pl ${args[*]}" +} + activate() { #create or remove activate file @@ -942,6 +953,7 @@ vyatta_config_complete () if (( ${#COMP_WORDS[@]} < 2 )); then declare -a hitems=( "activate" \ + "comment" \ "commit" \ "copy" \ "deactivate" \ @@ -959,6 +971,7 @@ vyatta_config_complete () "show" ) declare -a hstrs=( \ "Enable this portion of the configuration" \ + "Add comment to this configuration element" \ "Commit the current set of changes" \ "Copy a configuration element" \ "Inactivate this portion of the configuration" \ @@ -1310,6 +1323,7 @@ complete -F vyatta_loadsave_complete save complete -F vyatta_loadsave_complete load complete -F vyatta_loadsave_complete merge complete -F vyatta_loadkey_complete loadkey +complete -F vyatta_config_complete comment complete -F vyatta_config_complete activate complete -F vyatta_config_complete deactivate complete -F vyatta_config_complete copy -- cgit v1.2.3