]>
Commit | Line | Data |
---|---|---|
0a735ded VB |
1 | #compdef lldpcli |
2 | # | |
3 | # zsh completion for lldpcli | |
4 | # | |
5 | # Copyright (c) 2014 Vincent Bernat <bernat@luffy.cx> | |
6 | # | |
7 | # Permission to use, copy, modify, and/or distribute this software for any | |
8 | # purpose with or without fee is hereby granted, provided that the above | |
9 | # copyright notice and this permission notice appear in all copies. | |
10 | # | |
11 | # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | ||
19 | ||
20 | __lldpcli_command () { | |
21 | local -a completions | |
22 | completions=(${(f)"$(_call_program commands lldpcli complete ${words[1,$(($CURRENT-1))]})"}) | |
23 | completions=(${completions:s/ /:/}) | |
24 | _describe -t lldpcli-command "lldpcli completion" completions "$@" | |
25 | } | |
26 | ||
27 | _lldpcli () { | |
0a735ded VB |
28 | _arguments -C \ |
29 | '*-d[print more debugging information]' \ | |
30 | '(- *)-v[print version number and exit]' \ | |
31 | '-u[use an alternate socket with lldpd]:UNIX socket:_files' \ | |
96197b73 | 32 | '-f[output format]:format:(plain xml json json0 keyvalue)' \ |
0a735ded VB |
33 | '*-c[read a configuration file]:configuration file:_files' \ |
34 | '(-)*::lldpcli command:__lldpcli_command' | |
35 | } | |
36 | ||
37 | ||
38 | _lldpcli "$@" | |
8bddf214 VB |
39 | |
40 | # Local Variables: | |
41 | # mode: Shell-Script | |
42 | # sh-indentation: 4 | |
43 | # indent-tabs-mode: nil | |
44 | # sh-basic-offset: 4 | |
45 | # End: | |
46 | # vim: ft=zsh sw=4 ts=4 et |