App-reposdb
view release on metacpan or search on metacpan
script/reposdb-inline view on Meta::CPAN
#!perl
### begin code_after_shebang
# Note: This script is a CLI
# and generated automatically using Perinci::CmdLine::Gen version 0.497
### end code_after_shebang
# PERICMD_INLINE_SCRIPT: {"code_after_shebang":"...","config_dirs":null,"config_filename":"reposdb-inline.conf","env_name":"REPOSDB_INLINE_OPT","include":null,"log":null,"pack_deps":"0","pod":0,"read_config":1,"read_env":1,"script_name":"reposdb-inli...
my $_pci_metas = do{my$a={ls=>{args=>{detail=>{cmdline_aliases=>{l=>{}},schema=>["bool",{},{}],tags=>["category:field-selection"]},has_tags=>{element_completion=>sub{"DUMMY"},schema=>["array",{of=>["str",{req=>1},{}],req=>1},{}],tags=>["category:filt...
# This script is generated by Perinci::CmdLine::Inline version 0.551 on Sat Oct 10 19:58:23 2020.
# Rinci metadata taken from these modules: App::reposdb (no version)
# You probably should not manually edit this file.
our $DATE = '2020-10-10'; # DATE
our $VERSION = '0.007'; # VERSION
# PODNAME: reposdb-inline
package main;
use 5.010001;
use strict;
#use warnings;
# load modules
### declare global variables
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;
### 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;
require Getopt::Long::Subcommand;
my $help_msg = "Usage:\n reposdb-inline --help (or -h, -?)\n reposdb-inline --subcommands\n reposdb-inline --version (or -v)\n reposdb-inline [--cmd=subcommand_name] [--config-path=path+]\n [--config-profile=profile] [--format=name] [--json] [...
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]; },
'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"; },
'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; },
'subcommands' => sub { print "Available subcommands:\n ls\n remove-all-tags\n remove-tag\n touch\n"; exit 0 },
'version|v' => sub { no warnings 'once'; require App::reposdb; print "reposdb-inline version ", "0.007", ($App::reposdb::DATE ? " ($App::reposdb::DATE)" : ''), "\n"; print " Generated by Perinci::CmdLine::Inline version 0.551 (2020-05-18)\n"; exit...
};
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 {},
},
'format=s' => {
handler => sub {},
},
'help|h|?' => {
handler => sub {},
},
'json' => {
handler => sub {},
},
'naked-res' => {
handler => sub {},
},
'no-config' => {
handler => sub {},
},
'no-env' => {
handler => sub {},
},
'no-naked-res|nonaked-res' => {
handler => sub {},
script/reposdb-inline view on Meta::CPAN
&&
# check type 'str'
((!ref($args->{"reposdb_path"})) ? 1 : (($_sahv_err //= "Not of type text"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"status_time"}) {
$_sahv_dpath = [];
# skip if undef
(!defined($args->{"status_time"}) ? 1 :
(# check type 'bool'
((!ref($args->{"status_time"})) ? 1 : (($_sahv_err //= "Not of type boolean value"),0))
&&
(# clause: is
(($args->{"status_time"} ? 1:0) == (1 ? 1:0) ? 1 : (($_sahv_err //= "Must have the value 1"),0)))))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
if (exists $args->{"to"}) {
$_sahv_dpath = [];
# req #0
((defined($args->{"to"})) ? 1 : (($_sahv_err //= "Required but not specified"),0))
&&
# coerce rule(s): From_float::epoch, From_obj::datetime, From_obj::time_moment, From_str::iso8601 # coerce to: float(epoch)
(($args->{"to"} = (!ref($args->{"to"}) && $args->{"to"} =~ /\A[0-9]{8,10}(?:.[0-9]+)?\z/ && $args->{"to"} >= 10**8 && $args->{"to"} <= 2**31) ? [undef,$args->{"to"}] : ((Scalar::Util::blessed($args->{"to"}) && $args->{"to"}->isa('DateTime...
&&
# check type 'date'
((!ref($args->{"to"}) && $args->{"to"} =~ /\A[0-9]+\z/) ? 1 : (($_sahv_err //= "Not of type date"),0))
; if ($_sahv_err) { return [400, "Argument validation failed: $_sahv_err"] }
} # if date arg exists
# check required args
return [400, "Missing required value for argument: repo"] if exists($args->{"repo"}) && !defined($args->{"repo"});
return [400, "Missing required argument: reposdb_path"] unless exists $args->{"reposdb_path"};
return [400, "Missing required value for argument: reposdb_path"] if exists($args->{"reposdb_path"}) && !defined($args->{"reposdb_path"});
return [400, "Missing required value for argument: to"] if exists($args->{"to"}) && !defined($args->{"to"});
_pci_err([500, "Extraneous command-line argument(s): ".join(", ", @check_argv)]) if @check_argv;
[200];
} else { _pci_err([500, "Unknown subcommand1: $sc_name"]); }
}
1;
# END Local::_pci_check_args
# BEGIN Local::_pci_clean_json
sub _pci_clean_json { require Clone::PP; require Scalar::Util; use feature 'state'; state $cleanser = sub {
my $data = shift;
state %refs;
state $ctr_circ;
state $process_array;
state $process_hash;
if (!$process_array) { $process_array = sub { my $a = shift; for my $e (@$a) { my $ref=ref($e);
if ($ref && $refs{ $e }++) { if (++$ctr_circ <= 1) { $e = Clone::PP::clone($e); redo } else { $e = 'CIRCULAR'; $ref = '' } }
elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
elsif ($ref eq 'DateTime') { $e = $e->epoch; $ref = ref($e) }
elsif ($ref eq 'JSON::PP::Boolean') { $e = $e ? 1:0; $ref = '' }
elsif ($ref eq 'JSON::XS::Boolean') { $e = $e ? 1:0; $ref = '' }
elsif ($ref eq 'Math::BigInt') { $e = $e->bstr; $ref = ref($e) }
elsif ($ref eq 'Regexp') { $e = "$e"; $ref = "" }
elsif ($ref eq 'SCALAR') { $e = ${ $e }; $ref = ref($e) }
elsif ($ref eq 'Time::Moment') { $e = $e->epoch; $ref = ref($e) }
elsif ($ref eq 'version') { $e = "$e"; $ref = "" }
elsif (Scalar::Util::blessed($e)) { my $reftype = Scalar::Util::reftype($e); $e = $reftype eq "HASH" ? {%{ $e }} : $reftype eq "ARRAY" ? [@{ $e }] : $reftype eq "SCALAR" ? \(my $copy = ${ $e }) : $reftype eq "CODE" ? sub { goto &{ $e } } :(die "C...
my $reftype=Scalar::Util::reftype($e)//"";
if ($reftype eq "ARRAY") { $process_array->($e) }
elsif ($reftype eq "HASH") { $process_hash->($e) }
elsif ($ref) { $e = $ref; $ref = "" }
} } }
if (!$process_hash) { $process_hash = sub { my $h = shift; for my $k (keys %$h) { my $ref=ref($h->{$k});
if ($ref && $refs{ $h->{$k} }++) { if (++$ctr_circ <= 1) { $h->{$k} = Clone::PP::clone($h->{$k}); redo } else { $h->{$k} = 'CIRCULAR'; $ref = '' } }
elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
elsif ($ref eq 'DateTime') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
elsif ($ref eq 'JSON::PP::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
elsif ($ref eq 'JSON::XS::Boolean') { $h->{$k} = $h->{$k} ? 1:0; $ref = '' }
elsif ($ref eq 'Math::BigInt') { $h->{$k} = $h->{$k}->bstr; $ref = ref($h->{$k}) }
elsif ($ref eq 'Regexp') { $h->{$k} = "$h->{$k}"; $ref = "" }
elsif ($ref eq 'SCALAR') { $h->{$k} = ${ $h->{$k} }; $ref = ref($h->{$k}) }
elsif ($ref eq 'Time::Moment') { $h->{$k} = $h->{$k}->epoch; $ref = ref($h->{$k}) }
elsif ($ref eq 'version') { $h->{$k} = "$h->{$k}"; $ref = "" }
elsif (Scalar::Util::blessed($h->{$k})) { my $reftype = Scalar::Util::reftype($h->{$k}); $h->{$k} = $reftype eq "HASH" ? {%{ $h->{$k} }} : $reftype eq "ARRAY" ? [@{ $h->{$k} }] : $reftype eq "SCALAR" ? \(my $copy = ${ $h->{$k} }) : $reftype eq "C...
my $reftype=Scalar::Util::reftype($h->{$k})//"";
if ($reftype eq "ARRAY") { $process_array->($h->{$k}) }
elsif ($reftype eq "HASH") { $process_hash->($h->{$k}) }
elsif ($ref) { $h->{$k} = $ref; $ref = "" }
} } }
%refs = (); $ctr_circ=0;
for ($data) { my $ref=ref($_);
if ($ref && $refs{ $_ }++) { if (++$ctr_circ <= 1) { $_ = Clone::PP::clone($_); redo } else { $_ = 'CIRCULAR'; $ref = '' } }
elsif ($ref eq 'Cpanel::JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
elsif ($ref eq 'DateTime') { $_ = $_->epoch; $ref = ref($_) }
elsif ($ref eq 'JSON::PP::Boolean') { $_ = $_ ? 1:0; $ref = '' }
elsif ($ref eq 'JSON::XS::Boolean') { $_ = $_ ? 1:0; $ref = '' }
elsif ($ref eq 'Math::BigInt') { $_ = $_->bstr; $ref = ref($_) }
elsif ($ref eq 'Regexp') { $_ = "$_"; $ref = "" }
elsif ($ref eq 'SCALAR') { $_ = ${ $_ }; $ref = ref($_) }
elsif ($ref eq 'Time::Moment') { $_ = $_->epoch; $ref = ref($_) }
elsif ($ref eq 'version') { $_ = "$_"; $ref = "" }
elsif (Scalar::Util::blessed($_)) { my $reftype = Scalar::Util::reftype($_); $_ = $reftype eq "HASH" ? {%{ $_ }} : $reftype eq "ARRAY" ? [@{ $_ }] : $reftype eq "SCALAR" ? \(my $copy = ${ $_ }) : $reftype eq "CODE" ? sub { goto &{ $_ } } :(die "C...
my $reftype=Scalar::Util::reftype($_)//"";
if ($reftype eq "ARRAY") { $process_array->($_) }
elsif ($reftype eq "HASH") { $process_hash->($_) }
elsif ($ref) { $_ = $ref; $ref = "" }
}
$data
}
;; $cleanser->(shift) }
1;
# END Local::_pci_clean_json
### begin code_after_end
### end code_after_end
__END__
=pod
=encoding UTF-8
=head1 NAME
reposdb-inline
=head1 VERSION
This document describes version 0.007 of main (from Perl distribution App-reposdb), released on 2020-10-10.
=head1 SYNOPSIS
Usage:
% reposdb-inline ls [--config-path=path+] [--config-profile=profile]
[--detail] [--format=name] [--has-tag=s+] [--has-tags-json=s] [--json]
[-l] [--lacks-tag=s+] [--lacks-tags-json=s] [--(no)naked-res]
[--no-config] [--no-detail] [--no-env] [--nodetail]
[--page-result[=program]] [--reposdb-path=s] [--sort=s+]
[--sorts-json=s] [--view-result[=program]]
% reposdb-inline remove-all-tags [--config-path=path+]
[--config-profile=profile] [--format=name] [--json] [--(no)naked-res]
[--no-config] [--no-env] [--page-result[=program]] [--reposdb-path=s]
[--view-result[=program]] [repo]
% reposdb-inline remove-tag [--config-path=path+]
[--config-profile=profile] [--format=name] [--json] [--(no)naked-res]
[--no-config] [--no-env] [--page-result[=program]] [--reposdb-path=s]
[--view-result[=program]] [repo] <tags> ...
% reposdb-inline touch [--commit-time] [--config-path=path+]
[--config-profile=profile] [--format=name] [--json] [--(no)naked-res]
[--no-config] [--no-env] [--page-result[=program]] [--pull-time]
[--reposdb-path=s] [--status-time] [--to=s] [--view-result[=program]]
[repo]
=head1 DESCRIPTION
( run in 0.464 second using v1.01-cache-2.11-cpan-39bf76dae61 )