Getopt::Complete::Args(3pm) | User Contributed Perl Documentation | Getopt::Complete::Args(3pm) |
Getopt::Complete::Args - a set of option/value pairs
This document describes Getopt::Complete::Args 0.26.
This is used internally by Getopt::Complete during compile.
A hand-built implementation might use the objects directly, and look like this:
# process @ARGV... my $args = Getopt::Complete::Args->new( options => [ # or pass a Getopt::Complete::Options directly 'myfiles=s@' => 'f', 'name' => 'u', 'age=n' => undef, 'fast!' => undef, 'color' => ['red','blue','yellow'], ] argv => \@ARGV ); $args->options->handle_shell_completion; # support 'complete -F _getopt_complete myprogram' if (my @e = $args->errors) { for my $e (@e) { warn $e; } exit 1; } # on to normal running of the program... for my $name ($args->option_names) { my $spec = $args->option_spec($name); my $value = $args->value($name); print "option $name has specification $spec and value $value\n"; }
An object of this class describes a set of option/value pairs, built from a Getopt::Complete::Options object and a list of command-line arguments (@ARGV).
This is the class of the $Getopt::Complete::ARGS object, and $ARGS alias created at compile time. It is also the source of the %ARGS hash injected into both of those namepaces at compile time.
The same as ->value('>').
Distinct from ->sub_commands(), which returns the list of next possible choices when drilling down.
This is distinct from sub_command_path, which are the sub-commands which were chosen to get to this level in the tree.
Getopt::Complete, Getopt::Complete::Options, Getopt::Complete::Compgen
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.
2022-10-13 | perl v5.34.0 |