From 754ed8aad3ad39eafca7842f68af1dddb8c68718 Mon Sep 17 00:00:00 2001 From: Joe Bloggs Date: Wed, 26 Mar 2014 03:01:52 +0000 Subject: [PATCH] update --- zsh-completions-howto.org | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/zsh-completions-howto.org b/zsh-completions-howto.org index 57da55e..0b7e025 100644 --- a/zsh-completions-howto.org +++ b/zsh-completions-howto.org @@ -196,13 +196,16 @@ _arguments '-f[input file]:filename:_files' Command argument specifications take the form 'N:MESSAGE:ACTION' where N indicates that it is the Nth command argument, and MESSAGE & ACTION are as before. If the N is omitted then it just means the next command argument (after any that have -already been specified). For example: +already been specified). If a double colon is used at the start (after N) then the argument is optional. +For example: #+BEGIN_SRC sh -_arguments '-s[sort output]' '1:first arg:_net_interfaces' +_arguments '-s[sort output]' '1:first arg:_net_interfaces' '::optional arg:_files' ':next arg:(a b c)' #+END_SRC +here the first arg is a network interface, the next optional arg is a file name, the last arg can be either a, b or c, +and the -s option may be completed at any position. - - +I have just given you the basics of _arguments specifications here, you can also specify mutually exclusive options, +repeated options & arguments, options beginning with + insead of -, etc. For more details see the [[http://zsh.sourceforge.net/Doc/Release/Completion-System.html#Completion-System][official documentation]].