NAME
Getopt::Complete::Compgen - standard tab-completion callbacks
VERSION
This document describes Getopt::Complete::Compgen 0.26.
SYNOPSIS
# A completion spec can use any of the following, specified by a single
# word, or a single character, automatically:
use Getopt::Complete(
'myfile' => 'files', # or 'f'
'mydir' => 'directories', # or 'd'
'mycommand' => 'commands', # or 'c'
'myuser' => 'users', # or 'u'
'mygroup' => 'groups', # or 'd'
'myenv' => 'environment', # or 'e'
'myservice' => 'services', # or 's'
'myalias' => 'aliases', # or 'a'
'mybuiltin' => 'builtins' # or 'b'
);
DESCRIPTION
This module contains subroutines which can be used as callbacks with Getopt::Complete, and which implement all of the standard completions supported by the bash "compgen" builtin.
Running "compgen -o files abc" will produce the completion list as though the user typed "abc<TAB>", with the presumption the user is attempting to complete file names.
This module provides a subroutine names "files", with an alias named "f", which returns the same list.
The subroutine is suitable for use in a callback in a Getopt::Complete competion specification.
It does the equivalent for directories, executable commands, users, groups, environment variables, services, aliases and shell builtins.
These are the same:
@matches = Getopt::Complete::Compgen::files("whatevercommand","abc","whateverparam",$whatever_other_args);
@same = `bash -c "compgen -f sometext"`;
chomp @same;
These are equivalent in any spec:
\&Getopt::Complete::Compgen::files
\&Getopt;:Complete::Compgen::f
'Getopt::Complete::Compgen::files'
'Getopt;:Complete::Compgen::f'
'files'
'f'
SEE ALSO
The manual page for bash details the bash built-in command "compgen", which this wraps.
COPYRIGHT
Copyright 2010 Scott Smith and Washington University School of Medicine
AUTHORS
Scott Smith (sakoht at cpan .org)
LICENSE
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.