<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">NAME
    Perinci::CmdLine::Lite - A Rinci/Riap-based command-line application
    framework

VERSION
    This document describes version 1.924 of Perinci::CmdLine::Lite (from
    Perl distribution Perinci-CmdLine-Lite), released on 2022-10-19.

SYNOPSIS
    In "gen-random-num" script:

     use Perinci::CmdLine::Lite;

     our %SPEC;

     $SPEC{gen_random_num} = {
         v =&gt; 1.1,
         summary =&gt; 'Generate some random numbers',
         args =&gt; {
             count =&gt; {
                 summary =&gt; 'How many numbers to generate',
                 schema =&gt; ['int*' =&gt; min=&gt;0],
                 default =&gt; 1,
                 cmdline_aliases=&gt;{n=&gt;{}},
                 req =&gt; 1,
                 pos =&gt; 0,
             },
             min =&gt; {
                 summary =&gt; 'Lower limit of random number',
                 schema =&gt; 'float*',
                 default =&gt; 0,
             },
             max =&gt; {
                 summary =&gt; 'Upper limit of random number',
                 schema =&gt; 'float*',
                 default =&gt; 1,
             },
         },
         result_naked =&gt; 1,
     };
     sub gen_random_num {
         my %args = @_;

         my @res;
         for (1..$args{count}) {
             push @res, $args{min} + rand()*($args{max}-$args{min});
         }
         \@res;
     }

     Perinci::CmdLine::Lite-&gt;new(url =&gt; '/main/gen_random_num')-&gt;run;

    Run your script:

     % ./gen-random-num
     0.999473691060306

     % ./gen-random-num --min 1 --max 10 5
     1.27390166158969
     1.69077475473679
     8.97748327778684
     5.86943773494068
     8.34341298182493

    JSON output support out of the box:

     % ./gen-random-num -n3 --json
     [200,"OK (envelope added by Perinci::Access::Lite)",[0.257073684902029,0.393782991540746,0.848740540017513],{}]

    Automatic help message:

     % ./gen-random-num -h
     gen-random-num - Generate some random numbers

     Usage:
       gen-random-num --help (or -h, -?)
       gen-random-num --version (or -v)
       gen-random-num [options] [count]
     Options:
       --config-path=s     Set path to configuration file
       --config-profile=s  Set configuration profile to use
       --count=i, -n       How many numbers to generate (=arg[0]) [1]
       --format=s          Choose output format, e.g. json, text [undef]
       --help, -h, -?      Display this help message
       --json              Set output format to json
       --max=f             Upper limit of random number [1]
       --min=f             Lower limit of random number [0]
       --naked-res         When outputing as JSON, strip result envelope [0]
       --no-config         Do not use any configuration file
       --version, -v

    Automatic configuration file support:

     % cat ~/gen-random-num.conf
     count=5
     max=0.01

     % ./gen-random-num
     0.00105268954838724
     0.00701443611501844
     0.0021247476506154
     0.00813872824513005
     0.00752832346491306

    Automatic tab completion support:

     % complete -C gen-random-num gen-random-num
     % gen-random-num --mi&lt;tab&gt;

    See Perinci::CmdLine::Manual for details on other available features
    (subcommands, automatic formatting of data structures, automatic schema
    validation, dry-run mode, automatic POD generation, remote function
    support, automatic CLI generation, automatic --version, automatic HTTP
    API, undo/transactions, configurable output format, logging, progress
    bar, colors/Unicode, and more).

DESCRIPTION
    Perinci::CmdLine is a command-line application framework. It allows you
    to create full-featured CLI applications easily and quickly.

    See Perinci::CmdLine::Manual for more details.

    There is also a blog post series on Perinci::CmdLine tutorial:
    &lt;https://perlancar.wordpress.com/category/pericmd-tut/&gt;

    Perinci::CmdLine::Lite is the default backend implementation. Another
    implementation is the heavier Perinci::CmdLine::Classic which has a
    couple of more features not yet incorporated into ::Lite, e.g.
    transactions.

    You normally should use Perinci::CmdLine::Any instead to be able to
    switch backend on the fly.

REQUEST KEYS
    All those supported by Perinci::CmdLine::Base.

RESULT METADATA
    All those supported by Perinci::CmdLine::Base, plus:

  x.hint.result_binary =&gt; bool
    If set to true, then when formatting to "text" formats, this class won't
    print any newline to keep the data being printed unmodified.

ATTRIBUTES
    All the attributes of Perinci::CmdLine::Base, plus:

    *   validate_args =&gt; bool (default: 1)

        Validate arguments using schema from metadata.

METHODS
    All the methods of Perinci::CmdLine::Base, plus:

ENVIRONMENT
    All the environment variables that Perinci::CmdLine::Base supports,
    plus:

  DEBUG
    Set log level to 'debug'.

  VERBOSE
    Set log level to 'info'.

  QUIET
    Set log level to 'error'.

  TRACE
    Set log level to 'trace'.

  LOG_LEVEL
    Set log level.

  PROGRESS =&gt; bool
    Explicitly turn the progress bar on/off.

  FORMAT_PRETTY_TABLE_COLUMN_ORDERS =&gt; array (json)
    Set the default of "table_column_orders" in "format_options" in result
    metadata, similar to what's implemented in Perinci::Result::Format and
    Data::Format::Pretty::Console.

HOMEPAGE
    Please visit the project's homepage at
    &lt;https://metacpan.org/release/Perinci-CmdLine-Lite&gt;.

SOURCE
    Source repository is at
    &lt;https://github.com/perlancar/perl-Perinci-CmdLine-Lite&gt;.

SEE ALSO
    Perinci::CmdLine::Any

    Perinci::CmdLine::Classic

    Perinci::CmdLine::Inline

AUTHOR
    perlancar &lt;perlancar@cpan.org&gt;

CONTRIBUTORS
    *   Paul Cochrane &lt;paul@liekut.de&gt;

    *   Steven Haryanto &lt;stevenharyanto@gmail.com&gt;

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 Dist::Zilla,
    Dist::Zilla::PluginBundle::Author::PERLANCAR,
    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.

COPYRIGHT AND LICENSE
    This software is copyright (c) 2022, 2021, 2020, 2019, 2018, 2017, 2016,
    2015, 2014 by perlancar &lt;perlancar@cpan.org&gt;.

    This is free software; you can redistribute it and/or modify it under
    the same terms as the Perl 5 programming language system itself.

BUGS
    Please report any bugs or feature requests on the bugtracker website
    &lt;https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-CmdLine-Lite&gt;

    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.

</pre></body></html>