App-SahUtils
view release on metacpan or search on metacpan
script/show-sah-value-rule-modules view on Meta::CPAN
v => 1.1,
summary => 'Show Data::Sah::Value::{,perl,js} module',
args => {
name => {
schema => ['perl::modname*'],
pos => 0,
completion => sub {
my %args = @_;
require Complete::Module;
require Complete::Util;
Complete::Util::combine_answers(
Complete::Module::complete_module(
word => $args{word},
ns_prefix => 'Data::Sah::Value',
),
Complete::Module::complete_module(
word => $args{word},
ns_prefix => 'Data::Sah::Value::perl',
),
Complete::Module::complete_module(
word => $args{word},
ns_prefix => 'Data::Sah::Value::js',
),
);
},
},
list => {
schema => ['bool', is=>1],
cmdline_aliases => {l=>{}},
},
},
};
sub app {
my %args = @_;
my $name = $args{name};
if ($args{list}) {
my @res;
require Module::List::Tiny;
my $res = Module::List::Tiny::list_modules(
'Data::Sah::Value::', {list_modules=>1, recurse=>1});
for (sort keys %$res) {
s/\AData::Sah::Value:://;
push @res, $_;
}
return [200, "OK", \@res];
} elsif ($name) {
require File::Slurper;
require Module::Path::More;
$name =~ /\A\w+(::\w+)*\z/
or return [400, "Invalid module name '$name'"];;
my $found;
for my $prefix ("Data::Sah::Value", "Data::Sah::Value::perl", "Data::Sah::Value::js", "") {
my $fullname = "$prefix\::$name";
my $path = Module::Path::More::module_path(module => $fullname);
next unless $path;
$found++;
return [200, "OK", File::Slurper::read_text($path)];
}
return [404, "No such value rule module name '$name'"] unless $found;
} else {
return [400, "Please specify name of a Sah value rule module (or -l)"];
}
}
Perinci::CmdLine::Any->new(
url => '/main/app',
pass_cmdline_object => 1,
)->run;
# ABSTRACT: List Sah coerce rule modules
# PODNAME: show-sah-value-rule-modules
__END__
=pod
=encoding UTF-8
=head1 NAME
show-sah-value-rule-modules - List Sah coerce rule modules
=head1 VERSION
This document describes version 0.485 of show-sah-value-rule-modules (from Perl distribution App-SahUtils), released on 2024-08-06.
=head1 SYNOPSIS
B<show-sah-value-rule-modules> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>)
B<show-sah-value-rule-modules> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>)
B<show-sah-value-rule-modules> [B<L<--config-path|/"--config-path=s, -c">>=I<path>|B<L<-c|/"--config-path=s, -c">>|B<L<--no-config|/"--no-config, -C">>|B<L<-C|/"--no-config, -C">>] [B<L<--config-profile|/"--config-profile=s, -P">>=I<profile>|B<L<-P|/...
=head1 DESCRIPTION
REPLACE ME
=head1 OPTIONS
C<*> marks required options.
=head2 Configuration options
=over
=item B<--config-path>=I<s>, B<-c>
Set path to configuration file.
Can actually be specified multiple times to instruct application to read from
multiple configuration files (and merge them).
=item B<--config-profile>=I<s>, B<-P>
Set configuration profile to use.
A single configuration file can contain profiles, i.e. alternative sets of
( run in 0.646 second using v1.01-cache-2.11-cpan-39bf76dae61 )