App-IODUtils
view release on metacpan or search on metacpan
script/get-iod-section view on Meta::CPAN
#!perl
use 5.010;
use strict;
use warnings;
use App::IODUtils;
use Perinci::CmdLine::Any;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-06-24'; # DATE
our $DIST = 'App-IODUtils'; # DIST
our $VERSION = '0.164'; # VERSION
our %SPEC;
$SPEC{get_iod_section} = {
v => 1.1,
summary => 'Get whole section of IOD configuration file',
args => {
%App::IODUtils::common_args,
section => {
schema => 'str*',
req => 1,
pos => 1,
},
},
};
sub get_iod_section {
my %args = @_;
my $reader = App::IODUtils::_get_reader(\%args);
my $hoh = $reader->read_string($args{iod});
my $section = $args{section};
return [404, "No such section"] unless exists $hoh->{$section};
[200, "OK", $hoh->{$section}];
}
Perinci::CmdLine::Any->new(
url => '/main/get_iod_section',
read_config => 0,
read_env => 0,
)->run;
# ABSTRACT: Get whole section of IOD configuration file
# PODNAME: get-iod-section
__END__
=pod
=encoding UTF-8
=head1 NAME
get-iod-section - Get whole section of IOD configuration file
=head1 VERSION
This document describes version 0.164 of get-iod-section (from Perl distribution App-IODUtils), released on 2024-06-24.
=head1 SYNOPSIS
Basic usage:
% get-iod-section /path/to/file.iod section
=head1 OPTIONS
C<*> marks required options.
=head2 Main options
=over
=item B<--section>=I<s>*
(No description)
Can also be specified as the 2nd command-line argument.
=back
=head2 Output options
=over
=item B<--format>=I<s>
Choose output format, e.g. json, text.
Default value:
undef
( run in 0.584 second using v1.01-cache-2.11-cpan-39bf76dae61 )