summaryrefslogtreecommitdiff
path: root/etc/bash_completion.d
diff options
context:
space:
mode:
authorAn-Cheng Huang <ancheng@vyatta.com>2010-05-14 17:14:13 -0700
committerAn-Cheng Huang <ancheng@vyatta.com>2010-05-14 17:14:13 -0700
commit38ae54675fa5ea5a9bab5870b0a966e5f3da66ca (patch)
tree228274acf52cc4262d2b7274f470a4c9bcb29df7 /etc/bash_completion.d
parentd36d0a6ea76d443c5e4072401eaa9dbf563c74bd (diff)
downloadvyatta-cfg-38ae54675fa5ea5a9bab5870b0a966e5f3da66ca.tar.gz
vyatta-cfg-38ae54675fa5ea5a9bab5870b0a966e5f3da66ca.zip
POC implementation of unified enumeration mechanism
* use "enumeration" template field for both CLI completion and GUI2 enumeration support. * CLI completion now uses enumeration if it exists. * add "existing-interfaces" script as an example.
Diffstat (limited to 'etc/bash_completion.d')
-rwxr-xr-xetc/bash_completion.d/20vyatta-cfg8
1 files changed, 8 insertions, 0 deletions
diff --git a/etc/bash_completion.d/20vyatta-cfg b/etc/bash_completion.d/20vyatta-cfg
index 62a5440..03f0bb2 100755
--- a/etc/bash_completion.d/20vyatta-cfg
+++ b/etc/bash_completion.d/20vyatta-cfg
@@ -643,6 +643,7 @@ vyatta_parse_tmpl ()
# $1: tmpl
vyatta_cfg_help=""
vyatta_cfg_type=""
+ vyatta_cfg_enum=''
vyatta_cfg_tag=0
vyatta_cfg_multi=0
vyatta_cfg_allowed=()
@@ -659,11 +660,18 @@ vyatta_parse_tmpl ()
s/^tag:.*/vyatta_cfg_tag=1/p
s/^multi:.*/vyatta_cfg_multi=1/p
s/^type:[ ]\+\([^ ;]\+\)\(;.*\)\?/vyatta_cfg_type=\1/p
+ s/^enumeration:[ ]\+\([^ ]\+\)/vyatta_cfg_enum=\1/p
' $1`
vyatta_cfg_help=$(vyatta_parse_tmpl_comp_fields $1 "help")
local acmd=$(vyatta_parse_tmpl_comp_fields $1 "allowed")
+ if [ -n "$vyatta_cfg_enum" ]; then
+ local enum_script="/opt/vyatta/share/enumeration/$vyatta_cfg_enum"
+ if [ -f "$enum_script" ] && [ -e "$enum_script" ]; then
+ acmd="$enum_script"
+ fi
+ fi
vyatta_cfg_comp_help=$(vyatta_parse_tmpl_comp_fields $1 "comp_help")
if (( ${#vyatta_cfg_allowed[@]} == 0 )); then