NAME
Term::CLI::Role::ArgumentSet - Manage command arguments in Term::CLI
VERSION
version 0.059000
SYNOPSIS
package Term::CLI::Command {
use Moo;
with('Term::CLI::Role::ArgumentSet');
...
};
my $cmd = Term::CLI::Command->new( ... );
$cmd->add_argument( Term::CLI::Argument->new(...) );
say "argument names:", join(', ', $cmd->argument_names);
DESCRIPTION
Role for Term::CLI::Command(3p) elements to represent a set of Term::CLI::Argument(3p) objects.
This role is consumed by Term::CLI::Command(3p).
ATTRIBUTES
This role defines two additional attributes:
- arguments => ArrayRef
-
Reference to an array containing
Term::CLI::Argument
object instances that describe the parameters that the command takes, orundef
.Note that the elements of the array are copied over to an internal array, so modifications to the ArrayRef will not be seen.
ACCESSORS AND PREDICATES
- has_arguments
-
Predicate function that returns whether or not any Term::CLI::Arguments have been added.
- arguments
-
Return the list of Term::CLI::Argument object references that are owned by this object.
METHODS
- set_arguments ( ARG, ... )
-
Reset the list of arguments to (ARG, ...). Each ARG should be a reference to a Term::CLI::Argument object.
- add_argument ( ARG, ... )
-
Add ARG(s) to the argument set. Each ARG should be a reference to a Term::CLI::Argument object.
- argument_names
-
Return the list of (sub-)command names (in the order they were specified).
SEE ALSO
Term::CLI(3p), Term::CLI::Command(3p).
AUTHOR
Steven Bakker <sbakker@cpan.org>, 2018.
COPYRIGHT AND LICENSE
Copyright (c) 2018 Steven Bakker
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See "perldoc perlartistic."
This software is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.