summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
authorMichael Larson <slioch@slioch.vyatta.com>2010-05-14 13:47:21 -0700
committerMichael Larson <slioch@slioch.vyatta.com>2010-05-14 13:47:21 -0700
commitd36d0a6ea76d443c5e4072401eaa9dbf563c74bd (patch)
tree9daed3e19d3d5b8231a9894891ac00d4df9b9c3a /etc/bash_completion.d
parent91bb77e328c9cad994609aeeccb33971eca1486f (diff)
downloadvyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.tar.gz
vyatta-cfg-d36d0a6ea76d443c5e4072401eaa9dbf563c74bd.zip
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] ""
Diffstat (limited to 'etc/bash_completion.d')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg14
1 files changed, 14 insertions, 0 deletions
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