From a6c908d784d2d9b95a6df4c86f0a49338d7f6342 Mon Sep 17 00:00:00 2001 From: Jouke Witteveen Date: Sun, 4 Mar 2012 01:17:52 +0100 Subject: Completion brought up to date --- contrib/bash-completion | 86 ++++++++++++++++++++++++------------------------- 1 file changed, 43 insertions(+), 43 deletions(-) (limited to 'contrib/bash-completion') diff --git a/contrib/bash-completion b/contrib/bash-completion index cb09803..8ec6a12 100644 --- a/contrib/bash-completion +++ b/contrib/bash-completion @@ -2,57 +2,57 @@ _connected_prfls () { - COMPREPLY=( $( compgen -W "$( ls /run/network/profiles/ )" -- $cur ) ) + COMPREPLY=( $( compgen -W "$( ls /run/network/profiles/ )" -- $cur ) ) } _connected_intfs () { - COMPREPLY=( $( compgen -W "$( ls /run/network/interfaces/)" -- $cur ) ) + COMPREPLY=( $( compgen -W "$( ls /run/network/interfaces/)" -- $cur ) ) } _netcfg () { - local cur prev opts lopts cmds prfls - - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - - opts="-c -d -a -i -h -v -r" - lopts="--help --version" - cmds="check-iface down all-down iface-down all-resume all-suspend reconnect" - prfls="`find /etc/network.d -maxdepth 1 -not -type d -printf '%f\n'`" - - case "${cur}" in - --*) - COMPREPLY=( $( compgen -W "${lopts}" -- $cur ) ) - return 0 - ;; - -*) - COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) ) - return 0 - ;; - *) - if [ $COMP_CWORD -eq 1 ]; then - COMPREPLY=( $( compgen -W "${opts} ${lopts} ${cmds} ${prfls}" -- $cur ) ) - fi - ;; - esac - - case "${prev}" in - -c|check-iface|-i|iface-down) - _connected_intfs - return 0 - ;; - -d|down|-r|reconnect) - _connected_prfls - return 0 - ;; - *) - ;; - esac - - return 0 + local cur prev opts lopts cmds prfls + + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + + opts="-l -c -u -r -R -d -i -a -v -h" + lopts="--help --version" + cmds="list current check-iface up reconnect iface-recon down iface-down all-down all-suspend" + prfls="`find /etc/network.d -maxdepth 1 -type f -not -name '*~' -not -name '*.conf' -not -name '.*' d -printf '%f\n'`" + + case "${cur}" in + --*) + COMPREPLY=( $( compgen -W "${lopts}" -- $cur ) ) + return 0 + ;; + -*) + COMPREPLY=( $( compgen -W "${opts} ${lopts}" -- $cur ) ) + return 0 + ;; + *) + if [ $COMP_CWORD -eq 1 ]; then + COMPREPLY=( $( compgen -W "${opts} ${lopts} ${cmds} ${prfls}" -- $cur ) ) + fi + ;; + esac + + case "${prev}" in + -R|iface-recon|-i|iface-down) + _connected_intfs + return 0 + ;; + -c|check-iface|-u|up|-r|reconnect|-d|down) + _connected_prfls + return 0 + ;; + *) + ;; + esac + + return 0 } complete -F _netcfg netcfg complete -F _netcfg netcfg2 -- cgit v1.2.3-24-g4f1b