App-INIUtils
view release on metacpan or search on metacpan
script/get-ini-section view on Meta::CPAN
#!perl
use 5.010;
use strict;
use warnings;
use App::INIUtils;
use Perinci::CmdLine::Any;
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
our $DATE = '2024-06-24'; # DATE
our $DIST = 'App-INIUtils'; # DIST
our $VERSION = '0.035'; # VERSION
our %SPEC;
$SPEC{get_ini_section} = {
v => 1.1,
summary => 'Get whole section of INI configuration file',
args => {
%App::INIUtils::args_common,
section => {
schema => 'str*',
req => 1,
pos => 1,
},
},
};
sub get_ini_section {
my %args = @_;
my $reader = App::INIUtils::_get_ciir_reader(\%args);
my $hoh = $reader->read_string($args{ini});
my $section = $args{section};
return [404, "No such section"] unless exists $hoh->{$section};
[200, "OK", $hoh->{$section}];
}
Perinci::CmdLine::Any->new(
url => '/main/get_ini_section',
read_config => 0,
read_env => 0,
)->run;
# ABSTRACT: Get whole section of INI configuration file
# PODNAME: get-ini-section
__END__
=pod
=encoding UTF-8
=head1 NAME
get-ini-section - Get whole section of INI configuration file
=head1 VERSION
This document describes version 0.035 of get-ini-section (from Perl distribution App-INIUtils), released on 2024-06-24.
=head1 SYNOPSIS
Basic usage:
% get-ini-section /path/to/file.ini 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.972 second using v1.01-cache-2.11-cpan-39bf76dae61 )