diff options
Diffstat (limited to 'etc/bash_completion.d/10vyatta-op')
-rw-r--r-- | etc/bash_completion.d/10vyatta-op | 34 |
1 files changed, 18 insertions, 16 deletions
diff --git a/etc/bash_completion.d/10vyatta-op b/etc/bash_completion.d/10vyatta-op index ebff99f..8ccb7ee 100644 --- a/etc/bash_completion.d/10vyatta-op +++ b/etc/bash_completion.d/10vyatta-op @@ -19,17 +19,19 @@ # # **** End License **** -test -z "$_vyatta_default_pager" && \ - declare -r _vyatta_default_pager="less\ +test -z "$_vyatta_less_options" && \ + declare -r _vyatta_less_options="\ --QUIT-AT-EOF\ --quit-if-one-screen\ - --LONG-PROMPT\ --RAW-CONTROL-CHARS\ --squeeze-blank-lines\ + --no-init" +test -z "$_vyatta_default_pager" && \ + declare -r _vyatta_default_pager="less \ --buffers=64\ --auto-buffers\ - --no-init\ - --no-lessopen" + --no-lessopen\ + $_vyatta_less_options" declare -x VYATTA_PAGER=$_vyatta_default_pager _vyatta_op_do_key_bindings () @@ -318,7 +320,8 @@ _vyatta_op_run () 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" ]] ; then + if [[ -t 1 && "$1" == "show" && \ + ! $run_cmd =~ ^\(LESSOPEN=\|less\|pager\|tail\).* ]] ; then eval "($run_cmd) | ${VYATTA_PAGER:-cat}" else eval "$run_cmd" @@ -421,16 +424,15 @@ _vyatta_pipe_completion () return 0 } -vtysh () -{ - if [ -S /var/run/vyatta/quagga/zebra.vty ] ; then - vyatta-vtysh "$@" - elif [ ! -S /var/run/quagga/zebra.vty ] ; then - /usr/bin/vtysh "$@" - else - echo "Can't connect with zebra daemon" - fi -} +if [ -S /var/run/vyatta/quagga/zebra.vty ] ; then + declare -x -r _vyatta_vtysh=vyatta-vtysh +elif [ ! -S /var/run/quagga/zebra.vty ] ; then + declare -x -r _vyatta_vtysh=/usr/bin/vtysh +else + declare -x -r _vyatta_vtysh="echo \"Can't connect with zebra daemon to run: vtysh \"" +fi + +alias vtysh=$_vyatta_vtysh # don't initialize if we are in configure mode if [ "$_OFR_CONFIGURE" == "ok" ]; then |