Zsh completion arguments: Difference between revisions
From wikinotes
(Created page with "= Examples = <blockquote> == Flag Arguments == <blockquote> <syntaxhighlight lang="bash"> _arguments \ {-h,--help}'[show help]' \ # short/long form (no value) '-o[outpu...") |
|||
Line 1: | Line 1: | ||
= | = Arguments = | ||
<blockquote> | <blockquote> | ||
== Flag Arguments == | == Flag Arguments == |
Revision as of 20:50, 24 July 2021
Arguments
Flag Arguments
_arguments \ {-h,--help}'[show help]' \ # short/long form (no value) '-o[output file]:::_files # short form w/ following value (a file)Positional Arguments
_arguments \ '1:user:_users' \ # 1st positional arg (required) '2:priority:(low med high)' \ # 2nd positional arg (required) (complete to low/med/high) '3::group:_groups' \ # 3nd positional arg (optional)Value for last defined Param
:${message}:${action} # reqd completion for prev command ::${message}:${action} # optional completion for prev command_arguments \ {-h,--help}'[show help]' \ '*::extra:(foo bar baz)' \ # any extra parameters, (complete to (foo bar baz)) ':value:(foo bar baz)' # after prev param (extra), always complete one of these wordsRest Arguments
Any arguments not consumed earlier use this completer.
*:${message}:${action} # *::${message}:${action} # *:::${message}:${action} #