Getopt::Complete::Compgen3pm
Standard tab-completion callbacks
Usage
# 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');
Version
This document describes Getopt::Complete::Compgen 0.26.
Overview
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'
Releases
6 releases since Debian 8 (Jessie); the text changed 3 times.