1
0
mirror of git://git.code.sf.net/p/zsh/code synced 2024-10-03 09:21:19 +02:00
zsh/Doc/Zsh/mod_computil.yo

60 lines
2.7 KiB
Plaintext
Raw Normal View History

COMMENT(!MOD!zsh/computil
A module with utility builtins needed for the shell function based
completion system.
!MOD!)
1999-10-15 11:45:45 +02:00
cindex(completion, utility)
The tt(zsh/computil) module adds several builtin commands that are used by
2000-05-21 20:27:36 +02:00
some of the completion functions in the completion system based on shell
functions (see
1999-10-15 11:45:45 +02:00
ifzman(zmanref(zshcompsys))\
ifnzman(noderef(Completion System))
2000-05-21 20:27:36 +02:00
). Except for tt(compquote) these builtin commands are very
1999-10-15 11:45:45 +02:00
specialised and thus not very interesting when writing your own
2000-05-21 20:27:36 +02:00
completion functions. In summary, these builtin commands are:
1999-10-15 11:45:45 +02:00
startitem()
item(tt(compquote) var(names) ...)(
There may be reasons to write completion functions that have to add
2000-05-21 20:27:36 +02:00
the matches using the tt(-Q) option to tt(compadd) and perform quoting
themselves. Instead of interpreting the first character of the
tt(all_quotes) key of the tt(compstate) special association and using
the tt(q) flag for parameter expansions, one can use this builtin
2000-05-21 20:27:36 +02:00
command. The arguments are the names of scalar or array parameters
and the values of these parameters are quoted as needed for the
innermost quoting level.
The return value is non-zero in case of an error and zero otherwise.
1999-10-15 11:45:45 +02:00
)
item(tt(compdescribe))(
This is used by the tt(_describe) function to build the displays for
the matches and to get the strings to add as matches with their
2000-05-21 20:27:36 +02:00
options. On the first call one of the options tt(-i) or tt(-I) should be
supplied as the first argument. In the first case, display strings without
the descriptions will be generated, in the second case, the string used to
separate the matches from their descriptions must be given as the
second argument and the descriptions (if any) will be shown. All other
1999-10-15 11:45:45 +02:00
arguments are like the definition arguments to tt(_describe) itself.
Once tt(compdescribe) has been called with either the tt(-i) or the
tt(-I) option, it can be repeatedly called with the tt(-g) option and
2000-05-21 20:27:36 +02:00
the names of five arrays as its arguments. This will step through the
1999-10-15 11:45:45 +02:00
different sets of matches and store the options in the first array,
the strings with descriptions in the second, the matches for these in
the third, the strings without descriptions in the fourth, and the
2000-05-21 20:27:36 +02:00
matches for them in the fifth array. These are then directly given to
1999-10-15 11:45:45 +02:00
tt(compadd) to register the matches with the completion code.
)
item(tt(comparguments))(
This is used by the tt(_arguments) function to do the argument and
2000-05-21 20:27:36 +02:00
command line parsing. Like tt(compdescribe) it has an option tt(-i) to
1999-10-15 11:45:45 +02:00
do the parsing and initialize some internal state and various options
to access the state information to decide what should be completed.
)
item(tt(compvalues))(
Like tt(comparguments), but for the tt(_values) function.
)
item(tt(comptags), tt(comptry))(
This implements the internals of the tags mechanism.
)
1999-10-15 11:45:45 +02:00
enditem()