NAME Complete - Completion modules family VERSION This document describes version 0.05 of Complete (from Perl distribution Complete), released on 2014-12-09. DESCRIPTION The namespace "Complete::" is used for the family of modules that deal with completion (including, but not limited to, shell tab completion, tab completion feature in other CLI-based application, web autocomplete, completion in GUI, etc). Compared to other modules, this (family of) module(s) tries to have a clear separation between general completion routine and shell-/environment specific ones, for more reusability. This POD page gives an overview of the modules in "Complete::*" namespace. Modules "Complete::Bash::*" modules are specific to bash shell. See Complete::Bash on some of the ways to do bash tab completion with Perl. Other shells are also supported. For shell-specific information, please refer to "Complete::Zsh", "Complete::Tcsh", "Complete::Fish". Other modules usually are named after the type of completion answer they provide. For example: Complete::Unix completes username/group name, Complete::Util completes from several generic sources: "complete_array_elem" completes from an array, "complete_env" from a list of environment variables, "complete_file" from files/directories on the filesystem. "Complete::*" modules for non-shell environment (like browser or GUI) have not been developed. Please check again from time to time in the future. "complete_*()" functions The main functions that do the actual completion are the "complete_*()" functions. These functions are generic completion routines: they accept the word to be completed, zero or more other arguments, and return a completion answer structure (see "Completion answer structure"). use Complete::Util qw(complete_array_elem); my $ary = complete_array_elem(array=>[qw/apple apricot banana/], word=>'ap'); # -> ['apple', 'apricot'] Completion answer structure "complete_*()" functions return completion answer structure. Completion answer contains the completion entries as well as extra metadata to give hints to formatters/tools. It is a hashref which can contain the following keys: * words => array This key is required. Its value is an array of completion entries. A completion entry can be a string or a hashref. Example: ['apple', 'apricot'] # array of strings [{word=>'apple', summary=>'A delicious fruit with thousands of varieties'}, {word=>'apricot', summary=>'Another delicious fruit'},] # array of hashes As you can see from the above, each entry can contain description (can be displayed in shells that support them, like fish and zsh). * type => str See Complete::Bash. * path_sep => str See Complete::Bash. * escmode => str See Complete::Bash. * static => bool Specify that completion is "static", meaning that it does not depend on external state (like filesystem) or a custom code which can return different answer everytime completion is requested. This can be useful for code that wants to generate completion code, like bash completion or fish completion. Knowing that completion for an option value is static means that completion for that option can be answered from an array instead of having to call code/program (faster). As a shortcut, completion answer can also be an arrayref (just the "words") without any metadata. Examples: # hash form {words=>[qw/apple apricot/]} # another hash form. type=env instructs formatter not to escape '$' {words=>[qw/$HOME $ENV/], type=>'env'} # array form ['apple', 'apricot'] # another array form, each entry is a hashref to include description [{word=>'apple', summary=>'A delicious fruit with thousands of varieties'}, {word=>'apricot', summary=>'Another delicious fruit'},] # array of hashes SEE ALSO HOMEPAGE Please visit the project's homepage at . SOURCE Source repository is at . BUGS Please report any bugs or feature requests on the bugtracker website When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. AUTHOR perlancar COPYRIGHT AND LICENSE This software is copyright (c) 2014 by perlancar@cpan.org. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.