diff options
author | Daniil Baturin <daniil@baturin.org> | 2018-06-24 13:20:39 +0200 |
---|---|---|
committer | Daniil Baturin <daniil@baturin.org> | 2018-06-24 13:20:39 +0200 |
commit | 997291b8a6a66953c6a6270c2dda323769452581 (patch) | |
tree | da24c0099caede14445289dca8d76560c08de1d9 /etc/bash_completion.d/vyatta-op | |
parent | 3610a467094e80a39b6627f6b7655430917b9bd3 (diff) | |
parent | add153b13de56f97624b2dc433fdbe21b36dbeed (diff) | |
download | vyatta-op-lithium.tar.gz vyatta-op-lithium.zip |
Merge branch 'current' into lithiumlithium
Conflicts:
Makefile.am
debian/changelog
templates/restart/dns/forwarding/node.def
templates/show/version/added/node.def
templates/show/version/all/node.def
templates/show/version/deleted/node.def
templates/show/version/downgraded/node.def
templates/show/version/node.def
templates/show/version/upgraded/node.def
Diffstat (limited to 'etc/bash_completion.d/vyatta-op')
-rw-r--r-- | etc/bash_completion.d/vyatta-op | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/etc/bash_completion.d/vyatta-op b/etc/bash_completion.d/vyatta-op index c820305..d917806 100644 --- a/etc/bash_completion.d/vyatta-op +++ b/etc/bash_completion.d/vyatta-op @@ -104,14 +104,14 @@ _vyatta_op_default_expand () local wc=${#COMP_WORDS[@]} if [[ "${COMP_WORDS[0]}" =~ "/" ]]; then # if we are looking for a directory on the first completion then do directory completions - _filedir_xspec + _filedir_xspec_vyos elif (( wc < 2 )) || [[ $COMP_CWORD -eq 0 ]] || [[ $1 == $2 ]]; then _vyatta_op_expand "$@" else # after the first word => cannot be vyatta command so use original default - _filedir_xspec + _filedir_xspec_vyos fi } @@ -500,7 +500,7 @@ strip-private () commands () { if [ "$_OFR_CONFIGURE" != "" ]; then - ${vyatta_sbindir}/vyatta-config-gen-sets.pl - + ${vyos_libexec_dir}/commands-pipe.py else echo "commands pipe is not supported in operational mode" fi @@ -599,6 +599,48 @@ _vyatta_set_comptype () done } +_filedir_xspec_vyos() +{ + local cur prev words cword + _init_completion || return + + _tilde "$cur" || return 0 + + local IFS=$'\n' xspec=${_xspec[${1##*/}]} tmp + local -a toks + + toks=( $( + compgen -d -- "$(quote_readline "$cur")" | { + while read -r tmp; do + printf '%s\n' $tmp + done + } + )) + + # Munge xspec to contain uppercase version too + # http://thread.gmane.org/gmane.comp.shells.bash.bugs/15294/focus=15306 + eval xspec="${xspec}" + local matchop=! + if [[ $xspec == !* ]]; then + xspec=${xspec#!} + matchop=@ + fi + xspec="$matchop($xspec|${xspec^^})" + + toks+=( $( + eval compgen -f -X "!$xspec" -- "\$(quote_readline "\$cur")" | { + while read -r tmp; do + [[ -n $tmp ]] && printf '%s\n' $tmp + done + } + )) + + if [[ ${#toks[@]} -ne 0 ]]; then + compopt -o filenames + COMPREPLY=( "${toks[@]}" ) + fi +} + nullglob_save=$( shopt -p nullglob ) shopt -s nullglob for f in ${vyatta_datadir}/vyatta-op/functions/allowed/* ; do |