NAME Complete::Getopt::Long - Complete command-line argument using Getopt::Long specification VERSION This document describes version 0.08 of Complete::Getopt::Long (from Perl distribution Complete-Getopt-Long), released on 2014-07-27. SYNOPSIS See Getopt::Long::Complete for an easy way to use this module. DESCRIPTION FUNCTIONS complete_cli_arg(%args) -> array|hash Complete command-line argument using Getopt::Long specification. This routine can complete option names, where the option names are retrieved from "Getopt::Long" specification. If you provide completion hints in "hints", you can also complete option *values* and *arguments*. Arguments ('*' denotes required arguments): * completion => *hash* Completion routine to complete option value/argument. Completion code will receive a hash of arguments containing these keys: * "type" (str, what is being completed, either "optname", "optval", or "arg") * "word" (str, word to be completed) * "opt" (str, option name, e.g. "--str"; undef if we're completing argument) * "ospec" (str, Getopt::Long option spec, e.g. "str|S=s"; undef when completing argument) * "argpos" (int, argument position, zero-based; undef if completing option) * "parent_args" * "seen_opts" (hash, all the options seen in "words") and is expected to return a completion reply in the form of array. The various "complete_*" function like those in "Complete::Util" or the other "Complete::*" modules are suitable to use here. Code can also return undef, in which the default completion routine is called. It completes from environment variables ($foo), usernames ("~foo"), and files. Example: use Complete::Unix qw(complete_user); use Complete::Util qw(complete_array_elem); complete_cli_arg( getopt_spec =E { 'help|h' =E sub{...}, 'format=s' =E \$format, 'user=s' =E \$user, }, completion =E sub { my %args = @_; my $word = $args{word}; my $ospec = $args{ospec}; if ($ospec && $ospec eq 'format=s') { complete_array(array=E[qw/json text xml yaml/], word=E$word); } else { complete_user(word=E$word); } }, ); * cword* => *int* Index in words of the word we're trying to complete. See function "parse_cmdline" in "Complete::Bash" on how to produce this (if you're using bash). * getopt_spec* => *hash* Getopt::Long specification. * words* => *array* Command line arguments, like @ARGV. See function "parse_cmdline" in "Complete::Bash" on how to produce this (if you're using bash). Return value: (any) You can use `format_completion` function in `Complete::Bash` module to format the result of this function for bash. SEE ALSO Getopt::Long::Complete Complete Complete::Bash Other modules related to bash shell tab completion: Bash::Completion, Getopt::Complete. Perinci::CmdLine - an alternative way to easily create command-line applications with completion feature. 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 Steven Haryanto COPYRIGHT AND LICENSE This software is copyright (c) 2014 by Steven Haryanto. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.