summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d/vyatta-op
diff options
context:
space:
mode:
authorMichael Larson <mike@vyatta.com>2011-01-17 16:23:49 -0800
committerMichael Larson <mike@vyatta.com>2011-01-17 16:23:49 -0800
commit9eb6b0a897e246fab4f170fb6b8dccbeb1a0f9ec (patch)
tree1f3f72a73ed63ebe4a3aa7595e7dbf48f4dc8456 /etc/bash_completion.d/vyatta-op
parent2dfa548420b05642b070c07b37fc8b01380e5803 (diff)
downloadvyatta-op-9eb6b0a897e246fab4f170fb6b8dccbeb1a0f9ec.tar.gz
vyatta-op-9eb6b0a897e246fab4f170fb6b8dccbeb1a0f9ec.zip
fix for bug 6476.
Diffstat (limited to 'etc/bash_completion.d/vyatta-op')
-rw-r--r--etc/bash_completion.d/vyatta-op64
1 files changed, 2 insertions, 62 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op
index 49b6768..aa516bc 100644
--- a/etc/bash_completion.d/vyatta-op
+++ b/etc/bash_completion.d/vyatta-op
@@ -66,6 +66,8 @@ declare _vyatta_op_node_path
declare -a _vyatta_op_noncompletions _vyatta_op_completions
declare -x -a _vyatta_pipe_noncompletions _vyatta_pipe_completions
+source /etc/bash_completion.d/vyatta-op-run
+
# $1: label
# #2...: strings
_vyatta_op_debug ()
@@ -108,26 +110,6 @@ _vyatta_op_init ()
shopt -s histverify
}
-_vyatta_op_get_node_def_field ()
-{
- local file=$1 field=$2
-
- sed -n '/^'"$field"':/,$ {
-# strip field name and hold rest of line
- s/[a-z]*: *//
- h
- :b
-# at EOF, print hold buffer and quit
- $ { x; p; q }
-# input next line
- n
-# if start of another field def, print hold buf and quit
- /^[a-z]*:/ { x; p; q }
-# add to hold buf and branch to input next line
- H
- bb
- }' $file
-}
# $1: label
# $2...: help
@@ -316,48 +298,6 @@ _vyatta_op_expand ()
eval "$restore_shopts"
}
-_vyatta_op_run ()
-{
- local -i estat
- local tpath=$vyatta_op_templates
- local restore_shopts=$( shopt -p extglob nullglob | tr \\n \; )
- shopt -s extglob nullglob
-
- _vyatta_op_last_comp=${_vyatta_op_last_comp_init}
- false; estat=$?
-
- i=1
- for arg in "$@"
- do
- if [ -f "$tpath/$arg/node.def" ] ; then
- tpath+=/$arg
- elif [ -f $tpath/node.tag/node.def ] ; then
- tpath+=/node.tag
- else
- echo "Invalid command" >&2
- eval $restore_shopts
- return 1
- fi
- let "i+=1"
- done
-
- local run_cmd=$(_vyatta_op_get_node_def_field $tpath/node.def run)
- local ret=0
- if [ -n "$run_cmd" ]; then
- if [[ -t 1 && "$1" == "show" && \
- ! $run_cmd =~ ^\(LESSOPEN=\|less\|pager\|tail\|/opt/vyatta/bin/vyatta-tshark-interface-port.pl\).* ]] ; then
- eval "($run_cmd) | ${VYATTA_PAGER:-cat}"
- else
- eval "$run_cmd"
- fi
- else
- echo "Incomplete command" >&2
- ret=1
- fi
- eval $restore_shopts
- return $ret
-}
-
# "pipe" functions
count ()
{