The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

peri-eg-test-completion - Do nothing, return args

VERSION

This document describes version 0.07 of peri-eg-test-completion (from Perl distribution Perinci-Examples-Bin-Classic), released on 2015-09-03.

SYNOPSIS

Usage:

 % peri-eg-test-completion [options] [i1] [a1]...

DESCRIPTION

This function is used to test argument completion.

OPTIONS

* marks required options.

Configuration options

--config-path=filename

Set path to configuration file.

Can be specified multiple times.

--config-profile=s

Set configuration profile to use.

--no-config

Do not use any configuration file.

Environment options

--no-env

Do not read environment for default options.

Output options

--format-options=s

Pass options to formatter.

--format=s

Choose output format, e.g. json, text.

Default value:

 undef
--json

Equivalent to --format=json-pretty.

Other options

--a1-json=s

Array of strings, where the string has "in" schema clause (JSON-encoded).

See --a1.

--a1-yaml=s

Array of strings, where the string has "in" schema clause (YAML-encoded).

See --a1.

--a1=s@

Array of strings, where the string has "in" schema clause.

Completion library can perhaps complete from the `in` value and remember completed items when command-line option is repeated, e.g. in:

    --a1 <tab>

it will complete from any `in` value, but in:

    --a1 apple --a1 <tab>

it can exclude `apple` from the completion candidate.

Currently the completion library `Perinci::Sub::Complete` does not do this though. Perhaps there can be an option to toggle this behavior.

Can be specified multiple times.

--a2-json=s

Array with element_completion routine that generate random letter (JSON-encoded).

See --a2.

--a2-yaml=s

Array with element_completion routine that generate random letter (YAML-encoded).

See --a2.

--a2=s@

Array with element_completion routine that generate random letter.

Can be specified multiple times.

--a3-json=s

Array with element_completion routine that dies (JSON-encoded).

See --a3.

--a3-yaml=s

Array with element_completion routine that dies (YAML-encoded).

See --a3.

--a3=s@

Array with element_completion routine that dies.

See also `s3`.

Can be specified multiple times.

--arg0-json=s

Argument without any schema (JSON-encoded).

See --arg0.

--arg0-yaml=s

Argument without any schema (YAML-encoded).

See --arg0.

--arg0=s

Argument without any schema.

--f0=f

Float with just "float" schema defined.

--f1=f

Float with xmin/xmax on the schema.

A completion library can attempt to provide some possible and incremental completion (e.g. if word is currently at one decimal digit like 1.2, it can provide completion of 1.20 .. 1.29).

--help, -h, -?

Display help message and exit.

--i0=i

Integer with just "int" schema defined.

--i1=i

Integer with min/xmax on the schema.

A completion library (like `Perinci::Sub::Complete`) can generate a list of completion from the low end to the high end of the range, as long as it is not too long.

--i2=i

Integer with large range min/max on the schema.

Unlike in `i1`, a completion library probably won't generate a number sequence for this argument because they are considered too long (1000+ items).

--s1=s

String with possible values in "in" schema clause.

Valid values:

 ["apple","apricot","banana","grape","grapefruit","red date","red grape","green grape"]
--s1b=s

String with possible values in "in" schema clause, contains special characters.

Valid values:

 ["space: ","word containing spaces","single-quote: '","double-quote: \"","slash/","back\\slash","tab\t","word:with:colon","dollar \$sign","various parenthesis: [ ] { } ( )","tilde ~","backtick `","caret^","at\@","pound#","percent%","ampersand&","question?","wildcard*","comma,","semicolon;","pipe|","redirection > <","plus+"]

This argument is intended to test how special characters are escaped.

--s2=s

String with completion routine that generate random letter.

--s3=s

String with completion routine that dies.

Completion should not display error (except perhaps under debugging). It should just provide no completion.

--version, -v

Display program's version and exit.

COMPLETION

This script has shell tab completion capability with support for several shells.

bash

To activate bash completion for this script, put:

 complete -C peri-eg-test-completion peri-eg-test-completion

in your bash startup (e.g. ~/.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 shcompgen which allows you to activate completion scripts for several kinds of scripts on multiple shells. Some CPAN distributions (those that are built with Dist::Zilla::Plugin::GenShellCompletion) will even automatically enable shell completion for their included scripts (using shcompgen) at installation time, so you can immadiately have tab completion.

tcsh

To activate tcsh completion for this script, put:

 complete peri-eg-test-completion 'p/*/`peri-eg-test-completion`/'

in your tcsh startup (e.g. ~/.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 shcompgen (see above).

other shells

For fish and zsh, install shcompgen as described above.

ENVIRONMENT

PERI_EG_TEST_COMPLETION => str

Specify additional command-line options

CONFIGURATION FILE

This script can read configuration file, which by default is searched at ~/.config/peri-eg-test-completion.conf, ~/peri-eg-test-completion.conf or /etc/peri-eg-test-completion.conf (can be changed by specifying --config-path). All found files will be read and merged.

To disable searching for configuration files, pass --no-config.

Configuration file is in the format of IOD, which is basically INI with some extra features.

You can put multiple profiles in a single file by using section names like [profile=SOMENAME]. Those sections will only be read if you specify the matching --config-profile SOMENAME.

List of available configuration parameters:

 a1 (see --a1)
 a2 (see --a2)
 a3 (see --a3)
 arg0 (see --arg0)
 f0 (see --f0)
 f1 (see --f1)
 format (see --format)
 format_options (see --format-options)
 i0 (see --i0)
 i1 (see --i1)
 i2 (see --i2)
 s1 (see --s1)
 s1b (see --s1b)
 s2 (see --s2)
 s3 (see --s3)

FILES

~/.config/peri-eg-test-completion.conf

~/peri-eg-test-completion.conf

/etc/peri-eg-test-completion.conf

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Perinci-Examples-Bin-Classic.

SOURCE

Source repository is at https://github.com/perlancar/perl-Perinci-Examples-Bin.

BUGS

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

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

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2015 by 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.