#!perl # Note: This script is a CLI for Riap function /App/KBLIUtils/list_kbli_codes # and generated automatically using Perinci::CmdLine::Gen version 0.502 use 5.010001; use strict; use warnings; use Log::ger; use Perinci::CmdLine::Any; our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY our $DATE = '2023-02-14'; # DATE our $DIST = 'App-KBLIUtils'; # DIST our $VERSION = '0.002'; # VERSION my $cmdline = Perinci::CmdLine::Any->new( url => "/App/KBLIUtils/list_kbli_codes", program_name => "list-kbli-codes", log => 1, pass_cmdline_object => 1, read_config => 0, read_env => 0, ); $cmdline->run; # ABSTRACT: List KBLI codes # PODNAME: list-kbli-codes __END__ =pod =encoding UTF-8 =head1 NAME list-kbli-codes - List KBLI codes =head1 VERSION This document describes version 0.002 of list-kbli-codes (from Perl distribution App-KBLIUtils), released on 2023-02-14. =head1 SYNOPSIS B<list-kbli-codes> B<L<--help|/"--help, -h, -?">> (or B<L<-h|/"--help, -h, -?">>, B<L<-?|/"--help, -h, -?">>) B<list-kbli-codes> B<L<--version|/"--version, -v">> (or B<L<-v|/"--version, -v">>) B<list-kbli-codes> [B<L<--code-contains|/"--code-contains=s">>=I<str>] [(B<L<--code-in|/"--code-in=s@">>=I<str>)+|B<L<--code-in-json|/"--code-in=s@">>=I<json>] [B<L<--code-is|/"--code-is=s">>=I<str>] [B<L<--code-isnt|/"--code-isnt=s">>=I<str>] [B<L<--code-max|/"--code-max=s">>=I<str>] [B<L<--code-min|/"--code-min=s">>=I<str>] [B<L<--code-not-contains|/"--code-not-contains=s">>=I<str>] [(B<L<--code-not-in|/"--code-not-in=s@">>=I<str>)+|B<L<--code-not-in-json|/"--code-not-in=s@">>=I<json>] [B<L<--code-xmax|/"--code-xmax=s">>=I<str>] [B<L<--code-xmin|/"--code-xmin=s">>=I<str>] [B<L<--code|/"--code=s">>=I<str>] [B<L<--debug|/"--debug">>|B<L<--log-level|/"--log-level=s">>=I<level>|B<L<--quiet|/"--quiet">>|B<L<--trace|/"--trace">>|B<L<--verbose|/"--verbose">>] [B<L<--description-contains|/"--description-contains=s">>=I<str>] [(B<L<--description-in|/"--description-in=s@">>=I<str>)+|B<L<--description-in-json|/"--description-in=s@">>=I<json>] [B<L<--description-is|/"--description-is=s">>=I<str>] [B<L<--description-isnt|/"--description-isnt=s">>=I<str>] [B<L<--description-max|/"--description-max=s">>=I<str>] [B<L<--description-min|/"--description-min=s">>=I<str>] [B<L<--description-not-contains|/"--description-not-contains=s">>=I<str>] [(B<L<--description-not-in|/"--description-not-in=s@">>=I<str>)+|B<L<--description-not-in-json|/"--description-not-in=s@">>=I<json>] [B<L<--description-xmax|/"--description-xmax=s">>=I<str>] [B<L<--description-xmin|/"--description-xmin=s">>=I<str>] [B<L<--description|/"--description=s">>=I<str>] [B<L<--detail|/"--detail, -l">>|B<L<-l|/"--detail, -l">>|B<L<--no-detail|/"--detail, -l">>|B<L<--nodetail|/"--detail, -l">>] [(B<L<--exclude-field|/"--exclude-fields-json=s">>=I<str>)+|B<L<--exclude-fields-json|/"--exclude-fields-json=s">>=I<json>] [(B<L<--field|/"--fields-json=s">>=I<str>)+|B<L<--fields-json|/"--fields-json=s">>=I<json>] [B<L<--format|/"--format=s">>=I<name>|B<L<--json|/"--json">>] [B<L<--(no)naked-res|/"--naked-res">>] [B<L<--page-result|/"--page-result">>[=I<program>]|B<L<--view-result|/"--view-result">>[=I<program>]] [B<L<--query-boolean|/"--query-boolean=s">>=I<str>|B<L<--and|/"--query-boolean=s">>|B<L<--or|/"--query-boolean=s">>] [(B<L<--query|/"--query=s@">>=I<str>)+|B<L<--queries-json|/"--query=s@">>=I<json>|(B<L<-q|/"--query=s@">>=I<str>)+] [B<L<--random|/"--random">>|B<L<--no-random|/"--random">>|B<L<--norandom|/"--random">>] [B<L<--result-limit|/"--result-limit=s">>=I<int>] [B<L<--result-start|/"--result-start=s">>=I<int>] [(B<L<--sort|/"--sort=s@">>=I<str>)+|B<L<--sort-json|/"--sort=s@">>=I<json>] [B<L<--title-contains|/"--title-contains=s">>=I<str>] [(B<L<--title-in|/"--title-in=s@">>=I<str>)+|B<L<--title-in-json|/"--title-in=s@">>=I<json>] [B<L<--title-is|/"--title-is=s">>=I<str>] [B<L<--title-isnt|/"--title-isnt=s">>=I<str>] [B<L<--title-max|/"--title-max=s">>=I<str>] [B<L<--title-min|/"--title-min=s">>=I<str>] [B<L<--title-not-contains|/"--title-not-contains=s">>=I<str>] [(B<L<--title-not-in|/"--title-not-in=s@">>=I<str>)+|B<L<--title-not-in-json|/"--title-not-in=s@">>=I<json>] [B<L<--title-xmax|/"--title-xmax=s">>=I<str>] [B<L<--title-xmin|/"--title-xmin=s">>=I<str>] [B<L<--title|/"--title=s">>=I<str>] [B<L<--with-field-names|/"--with-field-names">>|B<L<--without-field-names|/"--with-field-names">>] -- [I<L<query|/"--query=s@">>] ... =head1 DESCRIPTION REPLACE ME =head1 OPTIONS C<*> marks required options. =head2 Field selection options =over =item B<--detail>, B<-l> Return array of full records instead of just ID fields. By default, only the key (ID) field is returned per result entry. =item B<--exclude-field>=I<s@> Select fields to return. Can be specified multiple times. =item B<--exclude-fields-json>=I<s> Select fields to return (JSON-encoded). See C<--exclude-field>. =item B<--field>=I<s@> Select fields to return. Can be specified multiple times. =item B<--fields-json>=I<s> Select fields to return (JSON-encoded). See C<--field>. =item B<--with-field-names> Return field names in each record (as hash/associative array). When enabled, function will return each record as hash/associative array (field name => value pairs). Otherwise, function will return each record as list/array (field value, field value, ...). =back =head2 Filtering for code options =over =item B<--code-contains>=I<s> Only return records where the 'code' field contains specified text. =item B<--code-in-json>=I<s> Only return records where the 'code' field is in the specified values (JSON-encoded). See C<--code-in>. =item B<--code-in>=I<s@> Only return records where the 'code' field is in the specified values. Can be specified multiple times. =item B<--code-is>=I<s> Only return records where the 'code' field equals specified value. =item B<--code-isnt>=I<s> Only return records where the 'code' field does not equal specified value. =item B<--code-max>=I<s> Only return records where the 'code' field is less than or equal to specified value. =item B<--code-min>=I<s> Only return records where the 'code' field is greater than or equal to specified value. =item B<--code-not-contains>=I<s> Only return records where the 'code' field does not contain specified text. =item B<--code-not-in-json>=I<s> Only return records where the 'code' field is not in the specified values (JSON-encoded). See C<--code-not-in>. =item B<--code-not-in>=I<s@> Only return records where the 'code' field is not in the specified values. Can be specified multiple times. =item B<--code-xmax>=I<s> Only return records where the 'code' field is less than specified value. =item B<--code-xmin>=I<s> Only return records where the 'code' field is greater than specified value. =item B<--code>=I<s> Only return records where the 'code' field equals specified value. =back =head2 Filtering for description options =over =item B<--description-contains>=I<s> Only return records where the 'description' field contains specified text. =item B<--description-in-json>=I<s> Only return records where the 'description' field is in the specified values (JSON-encoded). See C<--description-in>. =item B<--description-in>=I<s@> Only return records where the 'description' field is in the specified values. Can be specified multiple times. =item B<--description-is>=I<s> Only return records where the 'description' field equals specified value. =item B<--description-isnt>=I<s> Only return records where the 'description' field does not equal specified value. =item B<--description-max>=I<s> Only return records where the 'description' field is less than or equal to specified value. =item B<--description-min>=I<s> Only return records where the 'description' field is greater than or equal to specified value. =item B<--description-not-contains>=I<s> Only return records where the 'description' field does not contain specified text. =item B<--description-not-in-json>=I<s> Only return records where the 'description' field is not in the specified values (JSON-encoded). See C<--description-not-in>. =item B<--description-not-in>=I<s@> Only return records where the 'description' field is not in the specified values. Can be specified multiple times. =item B<--description-xmax>=I<s> Only return records where the 'description' field is less than specified value. =item B<--description-xmin>=I<s> Only return records where the 'description' field is greater than specified value. =item B<--description>=I<s> Only return records where the 'description' field equals specified value. =back =head2 Filtering for title options =over =item B<--title-contains>=I<s> Only return records where the 'title' field contains specified text. =item B<--title-in-json>=I<s> Only return records where the 'title' field is in the specified values (JSON-encoded). See C<--title-in>. =item B<--title-in>=I<s@> Only return records where the 'title' field is in the specified values. Can be specified multiple times. =item B<--title-is>=I<s> Only return records where the 'title' field equals specified value. =item B<--title-isnt>=I<s> Only return records where the 'title' field does not equal specified value. =item B<--title-max>=I<s> Only return records where the 'title' field is less than or equal to specified value. =item B<--title-min>=I<s> Only return records where the 'title' field is greater than or equal to specified value. =item B<--title-not-contains>=I<s> Only return records where the 'title' field does not contain specified text. =item B<--title-not-in-json>=I<s> Only return records where the 'title' field is not in the specified values (JSON-encoded). See C<--title-not-in>. =item B<--title-not-in>=I<s@> Only return records where the 'title' field is not in the specified values. Can be specified multiple times. =item B<--title-xmax>=I<s> Only return records where the 'title' field is less than specified value. =item B<--title-xmin>=I<s> Only return records where the 'title' field is greater than specified value. =item B<--title>=I<s> Only return records where the 'title' field equals specified value. =back =head2 Filtering options =over =item B<--and> Shortcut for --query-boolean=and. See C<--query-boolean>. =item B<--or> Shortcut for --query-boolean=or. See C<--query-boolean>. =item B<--queries-json>=I<s>, B<-q> Search (JSON-encoded). See C<--query>. Can also be specified as the 1st command-line argument and onwards. =item B<--query-boolean>=I<s> Whether records must match all search queries ('and') or just one ('or'). Default value: "and" Valid values: ["and","or"] If set to C<and>, all queries must match; if set to C<or>, only one query should match. See the C<queries> option for more details on searching. =item B<--query>=I<s@> Search. This will search all searchable fields with one or more specified queries. Each query can be in the form of C<-FOO> (dash prefix notation) to require that the fields do not contain specified string, or C</FOO/> to use regular expression. All queries must match if the C<query_boolean> option is set to C<and>; only one query should match if the C<query_boolean> option is set to C<or>. Can also be specified as the 1st command-line argument and onwards. Can be specified multiple times. =back =head2 Logging options =over =item B<--debug> Shortcut for --log-level=debug. =item B<--log-level>=I<s> Set log level. By default, these log levels are available (in order of increasing level of importance, from least important to most): C<trace>, C<debug>, C<info>, C<warn>/C<warning>, C<error>, C<fatal>. By default, the level is usually set to C<warn>, which means that log statements with level C<info> and less important levels will not be shown. To increase verbosity, choose C<info>, C<debug>, or C<trace>. For more details on log level and logging, as well as how new logging levels can be defined or existing ones modified, see L<Log::ger>. =item B<--quiet> Shortcut for --log-level=error. =item B<--trace> Shortcut for --log-level=trace. =item B<--verbose> Shortcut for --log-level=info. =back =head2 Ordering options =over =item B<--random> Return records in random order. =item B<--sort-json>=I<s> Order records according to certain field(s) (JSON-encoded). See C<--sort>. =item B<--sort>=I<s@> Order records according to certain field(s). A list of field names separated by comma. Each field can be prefixed with '-' to specify descending order instead of the default ascending. Can be specified multiple times. =back =head2 Output options =over =item B<--format>=I<s> Choose output format, e.g. json, text. Default value: undef Output can be displayed in multiple formats, and a suitable default format is chosen depending on the application and/or whether output destination is interactive terminal (i.e. whether output is piped). This option specifically chooses an output format. =item B<--json> Set output format to json. =item B<--naked-res> When outputing as JSON, strip result envelope. Default value: 0 By default, when outputing as JSON, the full enveloped result is returned, e.g.: [200,"OK",[1,2,3],{"func.extra"=>4}] The reason is so you can get the status (1st element), status message (2nd element) as well as result metadata/extra result (4th element) instead of just the result (3rd element). However, sometimes you want just the result, e.g. when you want to pipe the result for more post-processing. In this case you can use C<--naked-res> so you just get: [1,2,3] =item B<--page-result> Filter output through a pager. This option will pipe the output to a specified pager program. If pager program is not specified, a suitable default e.g. C<less> is chosen. =item B<--view-result> View output using a viewer. This option will first save the output to a temporary file, then open a viewer program to view the temporary file. If a viewer program is not chosen, a suitable default, e.g. the browser, is chosen. =back =head2 Paging options =over =item B<--result-limit>=I<s> Only return a certain number of records. =item B<--result-start>=I<s> Only return starting from the n'th record. Default value: 1 =back =head2 Other options =over =item B<--help>, B<-h>, B<-?> Display help message and exit. =item B<--version>, B<-v> Display program's version and exit. =back =head1 COMPLETION This script has shell tab completion capability with support for several shells. =head2 bash To activate bash completion for this script, put: complete -C list-kbli-codes list-kbli-codes in your bash startup (e.g. F<~/.bashrc>). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately. It is recommended, however, that you install modules using L<cpanm-shcompgen> which can activate shell completion for scripts immediately. =head2 tcsh To activate tcsh completion for this script, put: complete list-kbli-codes 'p/*/`list-kbli-codes`/' in your tcsh startup (e.g. F<~/.tcshrc>). Your next shell session will then recognize tab completion for the command. Or, you can also directly execute the line above in your shell to activate immediately. It is also recommended to install L<shcompgen> (see above). =head2 other shells For fish and zsh, install L<shcompgen> as described above. =head1 HOMEPAGE Please visit the project's homepage at L<https://metacpan.org/release/App-KBLIUtils>. =head1 SOURCE Source repository is at L<https://github.com/perlancar/perl-App-KBLIUtils>. =head1 AUTHOR perlancar <perlancar@cpan.org> =head1 CONTRIBUTING To contribute, you can send patches by email/via RT, or send pull requests on GitHub. Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via: % prove -l If you want to build the distribution (e.g. to try to install it locally on your system), you can install L<Dist::Zilla>, L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me. =head1 COPYRIGHT AND LICENSE This software is copyright (c) 2023 by perlancar <perlancar@cpan.org>. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. =head1 BUGS Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=App-KBLIUtils> When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature. =cut