App-unbelievable
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/App/unbelievable/CLI.pm view on Meta::CPAN
package App::unbelievable::CLI;
# see script/unbelievable for docs.
use App::unbelievable::Util;
use Cwd;
# === Runner for script/unbelievable ======================================
sub run {
require Getopt::Long::Subcommand;
require Pod::Usage;
my $args = shift or die "No args";
local @ARGV = @$args;
my %opts = ( # Defaults
verbose => 0
);
my $res = Getopt::Long::Subcommand::GetOptions(
summary => 'Build a static site',
default_subcommand => 'help',
# common options recognized by all subcommands
options => {
'help|h|?|usage' => {
summary => 'Display help message',
handler => \$opts{help},
#handler => sub {
# my ($cb, $val, $res) = @_;
# if ($res->{subcommand}) {
# say "Help message for $res->{subcommand} ...";
# } else {
# say "General help message ...";
# }
# exit 0;
#},
},
'man' => {
summary => 'Display full docs',
handler => \$opts{man},
},
'version|V' => {
summary => 'Display program version',
handler => sub {
say "$0 version $main::VERSION";
exit 0;
},
},
'verbose|v+' => {
handler => \$opts{verbose},
},
}, # options
# subcommands
subcommands => {
new => {
summary => 'Create a new site',
},
build => {
summary => 'Build the static html',
options => {
's|route-style=s' => {
summary => 'Which style of route to request',
handler => \$opts{route_style},
},
},
},
serve => {
summary => 'Serve the static HTML using a local server',
# TODO
#options => {
# 'server|s=s' => {
# summary => 'Which server to use',
# handler => \$opts{server},
view all matches for this distributionview release on metacpan - search on metacpan
( run in 1.552 second using v1.00-cache-2.02-grep-82fe00e-cpan-f5108d614456 )