App-pause
view release on metacpan or search on metacpan
script/pause view on Meta::CPAN
# This script is generated by Perinci::CmdLine::Inline version 0.554 on Mon Feb 24 11:35:30 2025.
# Rinci metadata taken from these modules: WWW::PAUSE::Simple 0.457
# You probably should not manually edit this file.
## no critic: TestingAndDebugging::RequireUseStrict
# PODNAME: pause
# ABSTRACT: A CLI for PAUSE
package main;
use 5.010001;
use strict;
#use warnings;
# load modules
### declare global variables
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2025-05-15'; # DATE
our $DIST = 'App-pause'; # DIST
our $VERSION = '0.662'; # VERSION
my $_pci_metas = do{my$var={cleanup=>{args=>{detail=>{cmdline_aliases=>{l=>{}},schema=>["bool",{}],summary=>"Whether to return detailed records"},exclude_dists=>{schema=>["array",{of=>["str",{req=>1}],req=>1}],summary=>"Exclude specified distribution...
our $_pci_log_outputs = {};
our $_pci_meta_result_stream = 0;
our $_pci_meta_result_type;
our $_pci_meta_result_type_is_simple;
our $_pci_meta_skip_format = 0;
our $_pci_r = {naked_res=>0,read_config=>1,read_env=>1,subcommand_name=>""};
our %_pci_args;
### begin code_before_enable_logging
require Log::ger::Layout::JSON;
### end code_before_enable_logging
### enable logging
$_pci_log_outputs->{Screen} = { conf => { colorize_tags => 1, formatter => sub { "pause: " . $_[0] } } };
#### begin code_add_extra_log_outputs
$_pci_log_outputs->{Screen}{category_level}{_access} = "off"; $_pci_log_outputs->{SimpleFile} = {conf=>{path => ($ENV{HOME} || ".")."/pause-access.log"}, level=>"off", layout=>[JSON=>{}], category_level=>{_access=>"info"}};
#### end code_add_extra_log_outputs
require Log::ger::Output; Log::ger::Output->set("Composite", outputs => $_pci_log_outputs);
require Log::ger; Log::ger->import;
### begin code_after_enable_logging
### end code_after_enable_logging
### declare subroutines
sub _pci_err {
my $res = shift;
print STDERR "ERROR $res->[0]: $res->[1]\n";
exit $res->[0]-300;
}
sub _pci_json {
state $json = do {
if (eval { require JSON::XS; 1 }) { JSON::XS->new->canonical(1)->allow_nonref }
else { require JSON::PP; JSON::PP->new->canonical(1)->allow_nonref }
};
$json;
}
### begin code_before_parse_cmdline_options
### end code_before_parse_cmdline_options
### get arguments (from config file, env, command-line args
{
my %mentioned_args;
require Getopt::Long::EvenLess;
log_trace("Parsing command-line arguments ...");
require Getopt::Long::Subcommand;
my $help_msg = "pause - A CLI for PAUSE\n\nUsage:\n pause --help (or -h, -?)\n pause --subcommands\n pause --version (or -v)\n pause [--cmd=subcommand_name] [(--config-path=path)+|--no-config]\n [--config-profile=profile] [--debug] [--format=n...
my $go_spec1 = {
'cmd=s' => sub { $_[2]{subcommand} = [$_[1]]; $_pci_r->{subcommand_name} = $_[1]; },
'config-path=s@' => sub { $_pci_r->{config_paths} //= []; push @{ $_pci_r->{config_paths} }, $_[1]; },
'config-profile=s' => sub { $_pci_r->{config_profile} = $_[1]; },
'debug' => sub { require Log::ger::Util; Log::ger::Util::set_level("debug"); $_pci_r->{log_level} = "debug"; },
'format=s' => sub { $_pci_r->{format} = $_[1]; },
'help|h|?' => sub { my $sc_name = $_pci_r->{subcommand_name}; my $first_non_opt_arg; for (@ARGV) { next if /^-/; $first_non_opt_arg = $_; last } if (!length $sc_name && defined $first_non_opt_arg) { $sc_name = $first_non_opt_arg } if (!length $sc_n...
'json' => sub { $_pci_r->{format} = (-t STDOUT) ? "json-pretty" : "json"; ## no critic InputOutput::ProhibitInteractiveTest
},
'log-level=s' => sub { if ($_[1] eq "trace") { require Log::ger::Util; Log::ger::Util::set_level("trace"); Log::ger::Output::Composite::set_level("trace") } if ($_[1] eq "debug") { require Log::ger::Util; Log::ger::Util::set_level("debug"); Log::ge...
'naked-res' => sub { $_pci_r->{naked_res} = 1; },
'no-config' => sub { $_pci_r->{read_config} = 0; },
'no-env' => sub { $_pci_r->{read_env} = 0; },
'no-naked-res|nonaked-res' => sub { $_pci_r->{naked_res} = 0; },
'page-result:s' => sub { $_pci_r->{page_result} = 1; },
'quiet' => sub { require Log::ger::Util; Log::ger::Util::set_level("error"); $_pci_r->{log_level} = "error"; },
'subcommands' => sub { print "Available subcommands:\n cleanup\n ls\n ls-dists\n ls-mods\n reindex\n rm\n undelete\n upload\n"; exit 0 },
'trace' => sub { require Log::ger::Util; Log::ger::Util::set_level("trace"); $_pci_r->{log_level} = "trace"; },
'verbose' => sub { require Log::ger::Util; Log::ger::Util::set_level("info" ); $_pci_r->{log_level} = "info" ; },
'version|v' => sub { no warnings 'once'; require WWW::PAUSE::Simple; print "pause version ", $main::VERSION // '?', ($main::DATE ? " ($main::DATE)" : ''), "\n"; print " Generated by Perinci::CmdLine::Inline version 0.554 (2022-01-16)\n"; exit 0 },
};
my $go_spec2 = {
options => {
'cmd=s' => {
handler => sub { $_[2]{subcommand} = [$_[1]]; $_pci_r->{subcommand_name} = $_[1]; },
},
'config-path=s@' => {
handler => sub {},
},
'config-profile=s' => {
handler => sub {},
},
'debug' => {
handler => sub {},
},
'format=s' => {
handler => sub {},
},
'help|h|?' => {
handler => sub {},
},
'json' => {
handler => sub {},
},
'log-level=s' => {
( run in 0.741 second using v1.01-cache-2.11-cpan-e1769b4cff6 )