Perinci-CmdLine-Inline
view release on metacpan or search on metacpan
pass perlcritic policy TestingAndDebugging::RequireUseStrict.
0.551 2020-05-18 Released-By: PERLANCAR; Urgency: medium
- Observe PERINCI_CMDLINE_INLINE_DEBUG_DIE.
0.550 2020-05-02 Released-By: PERLANCAR; Urgency: medium
- When outputing streaming output, don't JSON-encode simple
(defined scalar) records.
- Add Log::ger::Output::{Composite,SimpleFile} to prereq
[RT#132474].
0.549 2020-04-29 Released-By: PERLANCAR; Urgency: medium
- Tweak Rinci metadata: replace deprecated
x.schema.{,element_}entity with more specific schema.
[ENHANCEMENTS]
- Add argument validation.
- Add option: allow_prereq.
- [Optimization] Don't include unneeded modules and subroutines to make
resulting script smaller (e.g. no need to include Text::Table::Tiny
and Perinci::Result::Format::Lite if we don't do formatting, no need
for _pci_gen_iter() when we don't accept streaming input or lines from
stdin/file, etc).
- [Optimization] Delay loading _pci_check_args, so --help and --version
can be a bit faster.
[BUG FIXES]
- Data cleansing was stil using (unincluded) Data::Clean::JSON instead
of our own generated cleanser.
- Replace JSON with JSON::MaybeXS.
0.36 2016-02-26 Released-By: PERLANCAR
- Implement cmdline_src=stdin_or_args (untested).
0.35 2016-02-04 Released-By: PERLANCAR
- [Bugfix] When streaming input (argument) has schema=array, use its
'of' clause subschema.
- Update to Test::Perinci::CmdLine 1.38.
0.34 2016-01-21 Released-By: PERLANCAR
- Update to Test::Perinci::CmdLine 1.33.
- [Bugfix] Don't render module version during script generation,
- Bump prereq version Log::Any::IfLOG to 0.07.
0.31 2015-11-28 Released-By: PERLANCAR
- [Bugfix] Handle function which returns naked result.
0.30 2015-11-27 Released-By: PERLANCAR
- Add support for streaming input (most of cmdline_src support are now
implemented too, except for: cmdline_src=stdin_line, the
-cmdline_src_XXX special arguments, and probably some minor quirks).
0.29 2015-11-27 Released-By: PERLANCAR
- Add support for streaming output (streaming input not yet).
0.28 2015-10-03 Released-By: PERLANCAR
- No functional changes.
- Update mentioned module App::fatten (has been renamed to
App::depak).
lib/Perinci/CmdLine/Inline.pm view on Meta::CPAN
push @l2, ' # fill defaults from "default" property and check against schema', "\n";
GEN_VALIDATION:
{
my $has_validation;
my @l3;
my @modules_for_all_args;
my @req_stmts;
for my $arg (sort keys %$args_prop) {
my $arg_spec = $args_prop->{$arg};
# we don't validate streaming input for now
next if $arg_spec->{stream};
my $arg_schema = $arg_spec->{schema};
my $arg_term = '$args->{"'.$arg.'"}';
if (defined $arg_spec->{default}) {
push @l3, " $arg_term //= ".dmp($arg_spec->{default}).";\n";
}
if ($arg_schema && $cd->{gen_args}{validate_args}) {
$has_validation++;
lib/Perinci/CmdLine/Inline.pm view on Meta::CPAN
$cd->{copts} = \%copts;
}
my $shebang_line;
{
$shebang_line = $args{shebang} // $^X;
$shebang_line = "#!$shebang_line" unless $shebang_line =~ /\A#!/;
$shebang_line .= "\n" unless $shebang_line =~ /\R\z/;
}
# this will be removed if we don't use streaming input or read from
# stdin
$cd->{sub_srcs}{_pci_gen_iter} = <<'_';
require Data::Sah::Util::Type;
my ($fh, $type, $argname) = @_;
if (Data::Sah::Util::Type::is_simple($type)) {
return sub {
# XXX this will be configurable later. currently by default reading
# binary is per-64k while reading string is line-by-line.
local $/ = \(64*1024) if $type eq 'buf';
# probably won't be unsupported
'completion',
'tx',
# already supported, but suite doesn't work yet
'cmdline_src',
# currently unsupported
'config-file-sets-common-options',
'dry-run',
'validate-streaming-input',
'validate-streaming-result',
'validate-result',
],
);
done_testing;
( run in 0.254 second using v1.01-cache-2.11-cpan-4d50c553e7e )