diff options
author | James Rayner <james@rayner.id.au> | 2010-11-21 03:35:47 +0100 |
---|---|---|
committer | James Rayner <james@rayner.id.au> | 2010-11-21 03:35:47 +0100 |
commit | 54edd2ea761b64dd44fc4b92eef90faaa2fbe2b0 (patch) | |
tree | e35beaf17a02f8f0d77b13e6f6a3ae6694724ccc | |
parent | b96b428d9ff44d3e007a2b81113390c734f2323d (diff) | |
download | netctl-54edd2ea761b64dd44fc4b92eef90faaa2fbe2b0.tar.gz netctl-54edd2ea761b64dd44fc4b92eef90faaa2fbe2b0.tar.xz |
FS#19823 - Improve zsh completion support
-rw-r--r-- | contrib/zsh-completion | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/contrib/zsh-completion b/contrib/zsh-completion index 9f74e42..078ccc8 100644 --- a/contrib/zsh-completion +++ b/contrib/zsh-completion @@ -1,6 +1,22 @@ #compdef netcfg netcfg2=netcfg 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 +} + all_profiles() { _path_files -W "/etc/network.d" -g "*(.)" } @@ -20,4 +36,13 @@ _arguments -C \ '(- *)-i[Take down profile active on specified interface]:Active interfaces:up_ifaces' \ '(- *)-r[Disconnect and reconnect specified profile]:Active profiles:up_profiles' \ '(- *)-u[Start specified profile]:Network profile:all_profiles' \ -'(- *)*:Network profile:all_profiles'
\ No newline at end of file +'(- *)*: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 +fi + |