Chapter 8: Command Line Editing

127

or -C options, the various shell variables set by the programmable completion facilities, while available, will not have useful values.

The matches will be generated in the same way as if the programmable com- pletion code had generated them directly from a completion specification with the same flags. If word is specified, only those completions matching word will be displayed.

The return value is true unless an invalid option is supplied, or no matches were generated. complete complete [-abcdefgjksuv] [-o comp-option] [-DE] [-A action] [-

G globpat] [-W wordlist]

[-F function] [-C command] [-X filterpat]

[-P prefix] [-S suffix] name [name ...] complete -pr [-DE] [name ...]

Specify how arguments to each name should be completed. If the -p option is supplied, or if no options are supplied, existing completion specifications are printed in a way that allows them to be reused as input. The -r option removes a completion specification for each name, or, if no names are supplied, all com- pletion specifications. The -D option indicates that the remaining options and actions should apply to the “default” command completion; that is, completion attempted on a command for which no completion has previously been defined.

The -E option indicates that the remaining options and actions should apply to

“empty” command completion; that is, completion attempted on a blank line.

The process of applying these completion specifications when word completion is attempted is described above (see Section 8.6 [Programmable Completion], page 124). The -D option takes precedence over -E.

Other options, if specified, have the following meanings. The arguments to the

-G, -W, and -X options (and, if necessary, the -P and -S options) should be quoted to protect them from expansion before the complete builtin is invoked.

-o comp-option

The comp-option controls several aspects of the compspec’s behav- ior beyond the simple generation of completions. comp-option may be one of: bashdefault

Perform the rest of the default Bash completions if the compspec generates no matches. default

Use Readline’s default filename completion if the comp- spec generates no matches. dirnames

Perform directory name completion if the compspec generates no matches. filenames

Tell Readline that the compspec generates filenames, so it can perform any filename-specific processing (like