Steven Haryanto > Perinci-Sub-Complete-0.62 > Perinci::Sub::Complete

Download:
Perinci-Sub-Complete-0.62.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.62   Source   Latest Release: Perinci-Sub-Complete-0.70

NAME ^

Perinci::Sub::Complete - Complete command-line argument using Rinci metadata

VERSION ^

This document describes version 0.62 of Perinci::Sub::Complete (from Perl distribution Perinci-Sub-Complete), released on 2014-08-06.

SYNOPSIS ^

See Perinci::CmdLine or Perinci::CmdLine::Lite or App::riap which use this module.

DESCRIPTION ^

FUNCTIONS ^

complete_arg_elem(%args) -> array

Given argument name and function metadata, complete array element.

Will attempt to complete using the completion routine specified in the argument specification, or if that is not specified, from argument's schema using complete_from_schema.

Arguments ('*' denotes required arguments):

Return value:

 (array)

complete_arg_val(%args) -> array

Given argument name and function metadata, complete value.

Will attempt to complete using the completion routine specified in the argument specification, or if that is not specified, from argument's schema using complete_from_schema.

Arguments ('*' denotes required arguments):

Return value:

 (array)

complete_cli_arg(%args) -> hash

Complete command-line argument using Rinci function metadata.

This routine uses Perinci::Sub::GetArgs::Argv to generate Getopt::Long specification from arguments list in Rinci function metadata and common options. Then, it will use Complete::Getopt::Long to complete option names, option values, as well as arguments.

Arguments ('*' denotes required arguments):

Return value:

 (hash)

You can use `format_completion` function in `Complete::Bash` module to format the result of this function for bash.

complete_from_schema(%args) -> [status, msg, result, meta]

Complete a value from schema.

Employ some heuristics to complete a value from Sah schema. For example, if schema is [str => in => [qw/new open resolved rejected/]], then we can complete from the in clause. Or for something like [int => between => [1, 20]] we can complete using values from 1 to 20.

Arguments ('*' denotes required arguments):

Return value:

Returns an enveloped result (an array).

First element (status) is an integer containing HTTP status code (200 means OK, 4xx caller error, 5xx function error). Second element (msg) is a string containing error message, or 'OK' if status is 200. Third element (result) is optional, the actual result. Fourth element (meta) is called result metadata and is optional, a hash that contains extra information.

 (any)

SEE ALSO ^

Complete, Complete::Getopt::Long

Perinci::CmdLine, Perinci::CmdLine::Lite, App::riap

HOMEPAGE ^

Please visit the project's homepage at https://metacpan.org/release/Perinci-Sub-Complete.

SOURCE ^

Source repository is at https://github.com/sharyanto/perl-Perinci-Sub-Complete.

BUGS ^

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-Sub-Complete

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.

AUTHOR ^

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2014 by Steven Haryanto.

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

syntax highlighting: