NAME

YA::CLI::ActionRole - Action handler role

VERSION

version 0.002

SYNOPSIS

package Foo;
use Moo;
with qw(YA::CLI::ActionRole);

sub action { "action" }
sub run { ...; }

DESCRIPTION

This role should be implemented by an action handler. The action handler should implement the following methods:

action

The action it handles, eg. provider

run

How the action should be run

METHODS

usage_pod

If the handler provides its own usage POD. If this is 0/undef, the POD of the script it used. If this function returns 1, it it taken from the file itself. Otherwise it is assumed the return value is the path to the POD itself.

cli_options

Add additional CLI options for the sub command. This will be parsed by Getopt::Long.

get_opts

Parse the options and returns a hash with the parsed options.

as_help

Returns an YA::CLI::Usage object which runs as a help

as_manpage

Returns an YA::CLI::Usage object which runs as a manpage

has_action

Checks if the supplied action is supported by the sub command

new_from_args

Instantiates the class with the CLI args that were given to them

AUTHOR

Wesley Schwengle <waterkip@cpan.org>

COPYRIGHT AND LICENSE

This software is Copyright (c) 2022 by Wesley Schwengle.

This is free software, licensed under:

The (three-clause) BSD License