There are some standard variables, initialised by the _main_complete
function and then used from other functions.
The standard variables are:
_comp_caller_options
The completion system uses setopt
to set a number of options. This
allows functions to be written without concern for compatibility with
every possible combination of user options. However, sometimes completion
needs to know what the user’s option preferences are. These are saved
in the _comp_caller_options
associative array. Option names, spelled
in lowercase without underscores, are mapped to one or other of the
strings ‘on
’ and ‘off
’.
_comp_priv_prefix
Completion functions such as _sudo
can set the _comp_priv_prefix
array to a command prefix that may then be used by _call_program
to
match the privileges when calling programs to generate matches.
Two more features are offered by the _main_complete
function. The
arrays compprefuncs
and comppostfuncs
may contain
names of functions that are to be called immediately before or after
completion has been tried. A function will only be called once unless
it explicitly reinserts itself into the array.