From 74ccd8d5a3d9e6f7e14d57f73d58d1319b99e9ca Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Wed, 9 Feb 2000 16:29:22 +0000 Subject: zsh-workers/9635 --- Doc/Zsh/mod_zutil.yo | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'Doc/Zsh') diff --git a/Doc/Zsh/mod_zutil.yo b/Doc/Zsh/mod_zutil.yo index 92f155b23..c488f8b02 100644 --- a/Doc/Zsh/mod_zutil.yo +++ b/Doc/Zsh/mod_zutil.yo @@ -111,4 +111,28 @@ The resulting strings are stored in the var(array). item(tt(zregexparse))( This implements the internals of the `tt(_regex_arguments)'. ) +item(tt(zparseopts) [ tt(-D) ] var(specs))( +This builtin can be used to parse the positional arguments and put +options found in them into separate arrays. Each var(spec) describes +one option which is given as its first character. If the second +character is either `tt(:)' or `tt(+)', the option takes an argument +(either directly following the option in the same word or in the next +word). After the option character or the `tt(:)' or `tt(+)' follows +the name of the array in which the option should be stored. The only +difference between the form with a `t(:)' and the one with a `tt(+)' +is that in the first case the option and its argument will be put in +the array only once (later occurrences overwriting earlier ones), +whereas with `tt(+)' all occurrences are moved to the array. + +If the tt(-D) option is given, all options found are removed from the +positional parameters leaving only those strings that did not match +any of the var(specs). + +For example, calling `tt(zparseopts afoo b:bar c+bar)' with the +strings `tt(-a)', `tt(-bx)', `tt(-c)', `tt(y)', `tt(-cz)', `tt(baz)' +and `tt(-cend)' as positional arguments will set the array tt(foo) to +contain the element `tt(-a)' and the array tt(bar) to the strings +`tt(-bx)', `tt(-cy)' and `tt(-cz)'. The `tt(baz)' and any strings +after it will not be used. +) enditem() -- cgit 1.4.1