| 1 |
package Perinci::CmdLine::Manual::HowTo::Completion; # just to make podweaver happy |
| 2 |
|
| 3 |
# AUTHORITY |
| 4 |
# DATE |
| 5 |
our $DIST = 'Perinci-CmdLine'; # DIST |
| 6 |
# VERSION |
| 7 |
|
| 8 |
1; |
| 9 |
# ABSTRACT: How-to guides related to completion |
| 10 |
|
| 11 |
__END__ |
| 12 |
|
| 13 |
=pod |
| 14 |
|
| 15 |
=encoding UTF-8 |
| 16 |
|
| 17 |
=head1 NAME |
| 18 |
|
| 19 |
Perinci::CmdLine::Manual::HowTo::Completion - How-to guides related to completion |
| 20 |
|
| 21 |
=head1 VERSION |
| 22 |
|
| 23 |
This document describes version 2.000.2 of Perinci::CmdLine::Manual::HowTo::Completion (from Perl distribution Perinci-CmdLine), released on 2026-03-30. |
| 24 |
|
| 25 |
=head1 DESCRIPTION |
| 26 |
|
| 27 |
In a Perinci::CmdLine-based CLI program, shell tab completion is mostly the |
| 28 |
issue of completing function arguments. A sample Rinci function metadata: |
| 29 |
|
| 30 |
{ |
| 31 |
v => 1.1, |
| 32 |
summary => 'A foo utility', |
| 33 |
args => { |
| 34 |
bar => { ... }, |
| 35 |
baz => { ... }, |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
Function argument names are simple, they are just taken from list of function |
| 40 |
arguments in the Rinci function metadata: |
| 41 |
|
| 42 |
% myprog --ba<tab> |
| 43 |
bar baz |
| 44 |
|
| 45 |
Completing function argument values is where the meat is. Completion can come |
| 46 |
from simple sources like schema: |
| 47 |
|
| 48 |
bar => { schema => ['str', in => ['one', 'two', 'three']], ... } |
| 49 |
|
| 50 |
% myprog --bar <tab> |
| 51 |
one three two |
| 52 |
|
| 53 |
or more complex sources. |
| 54 |
|
| 55 |
=head2 Completion from argument schema |
| 56 |
|
| 57 |
TODO |
| 58 |
|
| 59 |
=head2 Completion from configuration |
| 60 |
|
| 61 |
TODO |
| 62 |
|
| 63 |
=head2 Completion from custom completion routine |
| 64 |
|
| 65 |
TODO |
| 66 |
|
| 67 |
=head1 HOMEPAGE |
| 68 |
|
| 69 |
Please visit the project's homepage at L<https://metacpan.org/release/Perinci-CmdLine>. |
| 70 |
|
| 71 |
=head1 SOURCE |
| 72 |
|
| 73 |
Source repository is at L<https://github.com/perlancar/perl-Perinci-CmdLine>. |
| 74 |
|
| 75 |
=head1 SEE ALSO |
| 76 |
|
| 77 |
L<Log::ger> |
| 78 |
|
| 79 |
=head1 AUTHOR |
| 80 |
|
| 81 |
perlancar <[email protected]> |
| 82 |
|
| 83 |
=head1 CONTRIBUTING |
| 84 |
|
| 85 |
|
| 86 |
To contribute, you can send patches by email/via RT, or send pull requests on |
| 87 |
GitHub. |
| 88 |
|
| 89 |
Most of the time, you don't need to build the distribution yourself. You can |
| 90 |
simply modify the code, then test via: |
| 91 |
|
| 92 |
% prove -l |
| 93 |
|
| 94 |
If you want to build the distribution (e.g. to try to install it locally on your |
| 95 |
system), you can install L<Dist::Zilla>, |
| 96 |
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>, |
| 97 |
L<Pod::Weaver::PluginBundle::Author::PERLANCAR>, and sometimes one or two other |
| 98 |
Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond |
| 99 |
that are considered a bug and can be reported to me. |
| 100 |
|
| 101 |
=head1 COPYRIGHT AND LICENSE |
| 102 |
|
| 103 |
This software is copyright (c) 2026 by perlancar <[email protected]>. |
| 104 |
|
| 105 |
This is free software; you can redistribute it and/or modify it under |
| 106 |
the same terms as the Perl 5 programming language system itself. |
| 107 |
|
| 108 |
=head1 BUGS |
| 109 |
|
| 110 |
Please report any bugs or feature requests on the bugtracker website L<https://rt.cpan.org/Public/Dist/Display.html?Name=Perinci-CmdLine> |
| 111 |
|
| 112 |
When submitting a bug or request, please include a test-file or a |
| 113 |
patch to an existing test-file that illustrates the bug or desired |
| 114 |
feature. |
| 115 |
|
| 116 |
=cut |