peri-eg-completion - Do nothing, return args
This document describes version 0.081 of peri-eg-completion (from Perl distribution Perinci-Examples-Bin-Classic), released on 2021-01-30.
Usage:
% peri-eg-completion [--a2-json=s] [--a2=s+] [--a3-json=s] [--a3=s+] [--arg0-json=s] [--arg0=s] [--config-path=path+] [--config-profile=profile] [--f0=s] [--f1=s] [--format-options=s] [--format=name] [--h1-json=s] [--h1 key=s] [--h2-json=s] [--h2 key=s] [--i0=s] [--i2=s] [--json] [--(no)naked-res] [--no-config] [--no-env] [--s1=s] [--s1b=s] [--s1c=s] [--s1d=s] [--s2=s] [--s3=s] [i1] [a1] ...
This function is used to test argument completion.
* marks required options.
*
Array of strings, where the string has "in" schema clause (JSON-encoded).
See --a1.
--a1
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 <pm:Perinci::Sub::Complete> does not do this though. Perhaps there can be an option to toggle this behavior.
Can be specified multiple times.
Array with element_completion routine that generate random letter (JSON-encoded).
See --a2.
--a2
Array with element_completion routine that generate random letter.
Array with element_completion routine that dies (JSON-encoded).
See --a3.
--a3
Array with element_completion routine that dies.
See also `s3`.
Argument without any schema (JSON-encoded).
See --arg0.
--arg0
Argument without any schema.
Float with just "float" schema defined.
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).
Hash with "keys" and "allowed_keys" schema clauses and "element_completion" property (JSON-encoded).
See --h1.
--h1
Hash with "keys" and "allowed_keys" schema clauses and "element_completion" property.
Each value is a name-value pair, use key=value syntax. Can be specified multiple times.
Hash with "element_completion" as well as "index_completion" properties (JSON-encoded).
See --h2.
--h2
Hash with "element_completion" as well as "index_completion" properties.
Integer with just "int" schema defined.
Integer with min/xmax on the schema.
A completion library (like <pm: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.
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).
String with possible values in "in" schema clause.
Valid values:
["apple","apricot","banana","grape","grapefruit","red date","red grape","green grape"]
String with possible values in "in" schema clause, contains special characters.
["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.
String with examples in schema.
Example valid values:
["bar",{summary=>"foo",value=>"baz"}]
String with examples in argument spec.
String with completion routine that generate random letter.
String with completion routine that dies.
Completion should not display error (except perhaps under debugging). It should just provide no completion.
Set path to configuration file.
Set configuration profile to use.
Do not use any configuration file.
Do not read environment for default options.
Pass options to formatter.
Choose output format, e.g. json, text.
Default value:
undef
Equivalent to --format=json-pretty.
When outputing as JSON, strip result envelope.
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 `--naked-res` so you just get:
[1,2,3]
Display help message and exit.
Display program's version and exit.
This script has shell tab completion capability with support for several shells.
To activate bash completion for this script, put:
complete -C peri-eg-completion peri-eg-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 modules using cpanm-shcompgen which can activate shell completion for scripts immediately.
To activate tcsh completion for this script, put:
complete peri-eg-completion 'p/*/`peri-eg-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).
For fish and zsh, install shcompgen as described above.
This script can read configuration files. Configuration files are in the format of IOD, which is basically INI with some extra features.
By default, these names are searched for configuration filenames (can be changed using --config-path): /home/s1/.config/peri-eg-completion.conf, /home/s1/peri-eg-completion.conf, or /etc/peri-eg-completion.conf.
--config-path
All found files will be read and merged.
To disable searching for configuration files, pass --no-config.
--no-config
You can put multiple profiles in a single file by using section names like [profile=SOMENAME] or [SOMESECTION profile=SOMENAME]. Those sections will only be read if you specify the matching --config-profile SOMENAME.
[profile=SOMENAME]
[SOMESECTION profile=SOMENAME]
--config-profile SOMENAME
You can also put configuration for multiple programs inside a single file, and use filter program=NAME in section names, e.g. [program=NAME ...] or [SOMESECTION program=NAME]. The section will then only be used when the reading program matches.
program=NAME
[program=NAME ...]
[SOMESECTION program=NAME]
Finally, you can filter a section by environment variable using the filter env=CONDITION in section names. For example if you only want a section to be read if a certain environment variable is true: [env=SOMEVAR ...] or [SOMESECTION env=SOMEVAR ...]. If you only want a section to be read when the value of an environment variable has value equals something: [env=HOSTNAME=blink ...] or [SOMESECTION env=HOSTNAME=blink ...]. If you only want a section to be read when the value of an environment variable does not equal something: [env=HOSTNAME!=blink ...] or [SOMESECTION env=HOSTNAME!=blink ...]. If you only want a section to be read when an environment variable contains something: [env=HOSTNAME*=server ...] or [SOMESECTION env=HOSTNAME*=server ...]. Note that currently due to simplistic parsing, there must not be any whitespace in the value being compared because it marks the beginning of a new section filter or section name.
env=CONDITION
[env=SOMEVAR ...]
[SOMESECTION env=SOMEVAR ...]
[env=HOSTNAME=blink ...]
[SOMESECTION env=HOSTNAME=blink ...]
[env=HOSTNAME!=blink ...]
[SOMESECTION env=HOSTNAME!=blink ...]
[env=HOSTNAME*=server ...]
[SOMESECTION env=HOSTNAME*=server ...]
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) h1 (see --h1) h2 (see --h2) i0 (see --i0) i1 (see --i1) i2 (see --i2) naked_res (see --naked-res) s1 (see --s1) s1b (see --s1b) s1c (see --s1c) s1d (see --s1d) s2 (see --s2) s3 (see --s3)
Specify additional command-line options.
/home/s1/.config/peri-eg-completion.conf
/home/s1/peri-eg-completion.conf
/etc/peri-eg-completion.conf
Please visit the project's homepage at https://metacpan.org/release/Perinci-Examples-Bin-Classic.
Source repository is at https://github.com/perlancar/perl-Perinci-Examples-Bin.
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.
perlancar <perlancar@cpan.org>
This software is copyright (c) 2021, 2020, 2015, 2014, 2013, 2012 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.
To install Perinci::Examples::Bin::Classic, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Perinci::Examples::Bin::Classic
CPAN shell
perl -MCPAN -e shell install Perinci::Examples::Bin::Classic
For more information on module installation, please visit the detailed CPAN module installation guide.