Provided by: libgetopt-complete-perl_0.26-2_all
Getopt::Complete::Compgen - standard tab-completion callbacks
This document describes Getopt::Complete::Compgen 0.26.
# 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' );
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'
Getopt::Complete The manual page for bash details the bash built-in command "compgen", which this wraps.
Copyright 2010 Scott Smith and Washington University School of Medicine
Scott Smith (sakoht at cpan .org)
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.