summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJouke Witteveen <j.witteveen@gmail.com>2012-03-04 01:17:52 +0100
committerJouke Witteveen <j.witteveen@gmail.com>2012-03-04 01:17:52 +0100
commita6c908d784d2d9b95a6df4c86f0a49338d7f6342 (patch)
tree4b2ed96547c590d2618b009927db43d5c6eaa5d4
parent6b4c974d5a1a8d12831a6b0de72104368851b5a7 (diff)
downloadnetctl-a6c908d784d2d9b95a6df4c86f0a49338d7f6342.tar.gz
netctl-a6c908d784d2d9b95a6df4c86f0a49338d7f6342.tar.xz
Completion brought up to date
-rw-r--r--contrib/bash-completion86
-rw-r--r--contrib/zsh-completion56
2 files changed, 73 insertions, 69 deletions
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
diff --git a/contrib/zsh-completion b/contrib/zsh-completion
index 9f3e7dd..1f9fa9e 100644
--- a/contrib/zsh-completion
+++ b/contrib/zsh-completion
@@ -2,47 +2,51 @@
local -a disp
all_options() {
- local _subcommands
- _subcommands=('check-iface:Start the specified profile, only if its interface is not currently up'
- 'down:Stop the specified profile'
- 'reconnect:Disconnect and reconnect the specified profile'
- 'iface-down:Stop the profile up on the specified interface'
- 'all-down:Stop all connected profiles'
- 'all-suspend:Suspend and store the name of all active profiles'
- 'all-resume:Reconnect any profiles that have been suspended'
- 'current:Report currently running profiles'
- 'list:List all available profiles')
-
- _path_files -W "/etc/network.d" -g "*(.)"
- _describe 'subcommand' _subcommands
+ local _subcommands
+ _subcommands=('list:List all available profiles'
+ 'current:Report currently running profiles'
+ 'check-iface:Start the specified profile, only if its interface is not currently up'
+ 'up:Start the specified profile'
+ 'reconnect:Disconnect and reconnect the specified profile'
+ 'iface-recon:Reconnect profile active on specified interface'
+ 'down:Stop the specified profile'
+ 'iface-down:Stop the profile up on the specified interface'
+ 'all-down:Stop all connected profiles'
+ 'all-suspend:Suspend and store the name of all active profiles'
+ 'all-resume:Reconnect any profiles that have been suspended')
+
+ _path_files -W "/etc/network.d" -g "*(.)"
+ _describe 'subcommand' _subcommands
}
all_profiles() {
- _path_files -W "/etc/network.d" -g "*(.)"
+ _path_files -W "/etc/network.d" -g "*(.)"
}
up_profiles() {
- _files -W "/run/network/profiles"
+ _files -W "/run/network/profiles"
}
up_ifaces() {
- _files -W "/run/network/interfaces"
+ _files -W "/run/network/interfaces"
}
_arguments -C \
-'(- *)-c[Start specified profile if its interface is not currently up]:Network profile:all_profiles' \
-'(- *)-d[Take specified profile down]:Active profiles:up_profiles' \
-'(- *)-a[Take all active profiles down]' \
-'(- *)-i[Take down profile active on specified interface]:Active interfaces:up_ifaces' \
-'(- *)-r[Disconnect and reconnect specified profile]:Active profiles:up_profiles' \
+'(- *)-l[List all available profiles]' \
+'(- *)-c[Start the specified profile, only if its interface is not currently up]:Network profile:all_profiles' \
'(- *)-u[Start specified profile]:Network profile:all_profiles' \
+'(- *)-r[Disconnect and reconnect the specified profile]:Active profiles:up_profiles' \
+'(- *)-R[Reconnect profile active on specified interface]:Active interface:up_ifaces' \
+'(- *)-d[Take specified profile down]:Active profile:up_profiles' \
+'(- *)-i[Take down profile active on specified interface]:Active interface:up_ifaces' \
+'(- *)-a[Take all active profiles down]' \
'(- *)*:All options:all_options'
if [[ ${#words} == 3 ]]; then
- case $words[2] in
- 'check-iface') all_profiles;;
- 'reconnect' | 'down') up_profiles;;
- 'iface-down') up_ifaces;;
- esac
+ case $words[2] in
+ 'check-iface' | 'up') all_profiles;;
+ 'reconnect' | 'down') up_profiles;;
+ 'iface-recon' | 'iface-down') up_ifaces;;
+ esac
fi