summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/bash_completion.d/10vyatta-op17
-rw-r--r--templates/configure/node.def1
-rw-r--r--templates/terminal/key/node.def1
-rw-r--r--templates/terminal/key/query-help/node.def1
-rw-r--r--templates/terminal/key/query-help/node.tag/node.def10
-rw-r--r--templates/terminal/node.def2
6 files changed, 29 insertions, 3 deletions
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op
index 4eb5ba2..0af8f0c 100644
--- a/etc/bash_completion.d/10vyatta-op
+++ b/etc/bash_completion.d/10vyatta-op
@@ -35,8 +35,21 @@ test -z "$_vyatta_default_pager" && \
--no-lessopen"
declare -x VYATTA_PAGER=$_vyatta_default_pager
-# use '?' for help
-bind '"?": possible-completions'
+_vyatta_op_do_key_bindings ()
+{
+ if [ "$SHELL" == "/bin/vbash" ]; then
+ # only do this if vbash
+ bind '"?": possible-completions'
+ fi
+
+ nullglob_save=$(shopt -p nullglob)
+ shopt -u nullglob
+ bind_cmds=$(grep '^bind .* # vyatta key binding$' $HOME/.bashrc)
+ eval $bind_cmds
+ eval $nullglob_save
+}
+
+_vyatta_op_do_key_bindings
test -f /etc/default/vyatta && \
source /etc/default/vyatta
diff --git a/templates/configure/node.def b/templates/configure/node.def
index 67e17af..5d30510 100644
--- a/templates/configure/node.def
+++ b/templates/configure/node.def
@@ -1,2 +1,3 @@
help: Enter configure mode
run: export _OFR_CONFIGURE=ok; newgrp vyattacfg; unset _OFR_CONFIGURE
+ _vyatta_op_do_key_bindings
diff --git a/templates/terminal/key/node.def b/templates/terminal/key/node.def
new file mode 100644
index 0000000..3303752
--- /dev/null
+++ b/templates/terminal/key/node.def
@@ -0,0 +1 @@
+help: Configure key behaviors
diff --git a/templates/terminal/key/query-help/node.def b/templates/terminal/key/query-help/node.def
new file mode 100644
index 0000000..c15f556
--- /dev/null
+++ b/templates/terminal/key/query-help/node.def
@@ -0,0 +1 @@
+help: Enable/disable getting help using question mark
diff --git a/templates/terminal/key/query-help/node.tag/node.def b/templates/terminal/key/query-help/node.tag/node.def
new file mode 100644
index 0000000..dd27db3
--- /dev/null
+++ b/templates/terminal/key/query-help/node.tag/node.def
@@ -0,0 +1,10 @@
+help: Enable/disable getting help using question mark (default enabled)
+allowed: echo -n 'enable' 'disable'
+run: if [ "$4" == 'disable' ]; then
+ sed -i "/^bind '\"?\": .* # vyatta key binding$/d" $HOME/.bashrc
+ echo "bind '\"?\": self-insert' # vyatta key binding" >> $HOME/.bashrc
+ bind '"?": self-insert'
+ else
+ sed -i "/^bind '\"?\": .* # vyatta key binding$/d" $HOME/.bashrc
+ bind '"?": possible-completions'
+ fi
diff --git a/templates/terminal/node.def b/templates/terminal/node.def
index 85b7c7f..cdc1793 100644
--- a/templates/terminal/node.def
+++ b/templates/terminal/node.def
@@ -1 +1 @@
-help: Control terminal paging
+help: Control terminal behaviors