The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

YA::CLI - Yet another CLI framework

VERSION

version 0.007

SYNOPSIS

    package main;
    require Your::App;
    Your::App->run();


    package Your::App;
    use Moo;
    extends 'YA::CLI';

    __PACKAGE__->meta->make_immutable;


    package Your::App::SubCommand;
    use Moo;
    use namespace::autoclean;
    with 'YA::CLI::ActionRole';

    # This is the action your sub command is selected on
    sub action { 'main' } # can also be an array in case you want aliases

    # This is the subaction your sub command is selected on. This is an
    # optional sub, you don't need to implement it
    sub subaction { 'thing' } # can also be an array in case you want aliases

    sub run {
        # Logic here
    }

    __PACKAGE__->meta->make_immutable;

DESCRIPTION

A CLI framework for CLI applications that use subcommands

METHODS

run

Runs the application

default_search_path

Override the default search path, defaults to your Your::App namespace.

exclude_search_path

Excludes the search paths, can be a string, array ref or regexp

default_handler

Defaults to main for your default handler. If this handler cannot be found ultimatly falls back to YA::CLI::ErrorHandler which deals with just --help and --man commands. You can set this value to undef, which in turn will display the usage of your script.

cli_options

Define Getopt::Long options in your module that are used on top of the default help and man.

SEE ALSO

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