App-DocKnot

 view release on metacpan or  search on metacpan

lib/App/DocKnot/Command.pm  view on Meta::CPAN

# Dispatch code for the DocKnot application.
#
# DocKnot provides various commands for generating documentation, web pages,
# and software releases.  This module provides command-line parsing and
# dispatch of commands to the various App::DocKnot modules.
#
# SPDX-License-Identifier: MIT

##############################################################################
# Modules and declarations
##############################################################################

package App::DocKnot::Command v8.0.1;

use 5.024;
use autodie;
use warnings;

use App::DocKnot::Dist;
use App::DocKnot::Generate;
use App::DocKnot::Release;
use App::DocKnot::Spin;
use App::DocKnot::Spin::RSS;
use App::DocKnot::Spin::Thread;
use App::DocKnot::Update;
use Getopt::Long;
use Pod::Usage qw(pod2usage);

# Defines the subcommands, their options, and the module and method that
# implements them.  The keys are the names of the commands.  Each value is a
# hash with one or more of the following keys:
#
# code
#     A reference to a function to call to implement this command.  If set,
#     overrides method and module.  The function will be passed a reference to
#     the hash resulting from option parsing as its first argument and any
#     other command-line arguments as its remaining arguments.
#
# maximum
#     The maximum number of positional arguments this command takes.
#
# method
#     The name of the method to run to implement this command.  It is passed
#     as arguments any remaining command-line arguments after option parsing.
#
# minimum
#     The minimum number of positional arguments this command takes.
#
# module
#     The name of the module that implements this command.  Its constructor
#     (which must be named new) will be passed as its sole argument a
#     reference to the hash containing the results of parsing any options.
#
# options
#     A reference to an array of Getopt::Long option specifications defining
#     the arguments that can be passed to this subcommand.
#
# required
#     A reference to an array of required option names (the part before any |
#     in the option specification for that option).  If any of these options
#     are not set, an error will be thrown.
our %COMMANDS = (
    dist => {
        method  => 'make_distribution',
        module  => 'App::DocKnot::Dist',
        options => ['distdir|d=s', 'metadata|m=s', 'pgp-key|p=s'],
        maximum => 0,
    },
    generate => {
        method  => 'generate_output',
        module  => 'App::DocKnot::Generate',
        options => ['metadata|m=s', 'width|w=i'],
        maximum => 2,
        minimum => 1,
    },
    'generate-all' => {
        method  => 'generate_all',
        module  => 'App::DocKnot::Generate',
        options => ['metadata|m=s', 'width|w=i'],
        maximum => 0,
    },
    release => {
        method  => 'release',
        module  => 'App::DocKnot::Release',
        options => ['archivedir|a=s', 'distdir|d=s', 'metadata|m=s'],
        maximum => 0,
    },
    spin => {
        method  => 'spin',
        module  => 'App::DocKnot::Spin',
        options => ['delete|d', 'exclude|e=s@', 'style-url|s=s'],
        minimum => 2,
        maximum => 2,
    },
    'spin-rss' => {
        method  => 'generate',
        module  => 'App::DocKnot::Spin::RSS',
        options => ['base|b=s'],
        minimum => 1,
        maximum => 1,
    },
    'spin-text' => {
        method  => 'spin_text_file',
        module  => 'App::DocKnot::Spin::Text',
        options => [
            'modified|m', 'style|s=s', 'title|t=s', 'use-value|u',
        ],
        maximum => 2,
    },
    'spin-thread' => {
        method  => 'spin_thread_file',
        module  => 'App::DocKnot::Spin::Thread',
        options => ['style-url|s=s'],
        maximum => 2,
    },
    update => {
        method  => 'update',
        module  => 'App::DocKnot::Update',
        options => ['metadata|m=s', 'output|o=s'],
        maximum => 0,
    },



( run in 0.659 second using v1.01-cache-2.11-cpan-483215c6ad5 )