NAME
list-sah-coerce-rule-modules - List Sah coerce rule modules
VERSION
This document describes version 0.478 of list-sah-coerce-rule-modules (from Perl distribution App-SahUtils), released on 2021-07-27.
SYNOPSIS
Usage:
% list-sah-coerce-rule-modules [--config-path=path|-c|--no-config|-C] [--config-profile=profile|-P] [--detail|-l|--no-detail|--nodetail] [--dist-contains=str] [(--dist-in=str)+] [--dist-is=str] [--dist-isnt=str] [--dist-max=str] [--dist-min=str] [--dist-not-contains=str] [(--dist-not-in=str)+] [--dist-xmax=str] [--dist-xmin=str] [--dist=str] [(--exclude-field=str)+] [(--field=str)+] [--format=name|--json] [--might-fail|--no-might-fail|--nomight-fail] [--might-fail-is] [--might-fail-isnt] [--(no)naked-res] [--no-env] [--page-result[=program]|--view-result[=program]] [(--prio-in=int)+] [--prio-is=int] [--prio-isnt=int] [--prio-max=int] [--prio-min=int] [(--prio-not-in=int)+] [--prio-xmax=int] [--prio-xmin=int] [--prio=int] [--random|--no-random|--norandom] [--result-limit=int] [--result-start=int] [--rule-contains=str] [(--rule-in=str)+] [--rule-is=str] [--rule-isnt=str] [--rule-max=str] [--rule-min=str] [--rule-not-contains=str] [(--rule-not-in=str)+] [--rule-xmax=str] [--rule-xmin=str] [--rule=str] [(--sort=str)+] [--summary-contains=str] [(--summary-in=str)+] [--summary-is=str] [--summary-isnt=str] [--summary-max=str] [--summary-min=str] [--summary-not-contains=str] [(--summary-not-in=str)+] [--summary-xmax=str] [--summary-xmin=str] [--summary=str] [--v-arg=str] [--v-contains=str] [(--v-in=str)+] [--v-is=str] [--v-isnt=str] [--v-max=str] [--v-min=str] [--v-not-contains=str] [(--v-not-in=str)+] [--v-xmax=str] [--v-xmin=str] [--with-field-names|--without-field-names] [--dist-in-json=json] [--dist-not-in-json=json] [--exclude-fields-json=json] [--fields-json=json] [--prio-in-json=json] [--prio-not-in-json=json] [--rule-in-json=json] [--rule-not-in-json=json] [--sort-json=json] [--summary-in-json=json] [--summary-not-in-json=json] [--v-in-json=json] [--v-not-in-json=json] [--no-might-fail-is|--nomight-fail-is] [--no-might-fail-isnt|--nomight-fail-isnt] -- [query]
DESCRIPTION
REPLACE ME
OPTIONS
*
marks required options.
Configuration options
- --config-path=s, -c
-
Set path to configuration file.
- --config-profile=s, -P
-
Set configuration profile to use.
- --no-config, -C
-
Do not use any configuration file.
Environment options
Field selection options
- --detail, -l
-
Return array of full records instead of just ID fields.
By default, only the key (ID) field is returned per result entry.
- --exclude-field=s@
-
Select fields to return.
Can be specified multiple times.
- --exclude-fields-json=s
-
Select fields to return (JSON-encoded).
See
--exclude-field
. - --field=s@
-
Select fields to return.
Can be specified multiple times.
- --fields-json=s
-
Select fields to return (JSON-encoded).
See
--field
. - --with-field-names
-
Return field names in each record (as hash/associative array).
When enabled, function will return each record as hash/associative array (field name => value pairs). Otherwise, function will return each record as list/array (field value, field value, ...).
Filtering for dist options
- --dist-contains=s
-
Only return records where the 'dist' field contains specified text.
- --dist-in-json=s
-
Only return records where the 'dist' field is in the specified values (JSON-encoded).
See
--dist-in
. - --dist-in=s@
-
Only return records where the 'dist' field is in the specified values.
Can be specified multiple times.
- --dist-is=s
-
Only return records where the 'dist' field equals specified value.
- --dist-isnt=s
-
Only return records where the 'dist' field does not equal specified value.
- --dist-max=s
-
Only return records where the 'dist' field is less than or equal to specified value.
- --dist-min=s
-
Only return records where the 'dist' field is greater than or equal to specified value.
- --dist-not-contains=s
-
Only return records where the 'dist' field does not contain specified text.
- --dist-not-in-json=s
-
Only return records where the 'dist' field is not in the specified values (JSON-encoded).
See
--dist-not-in
. - --dist-not-in=s@
-
Only return records where the 'dist' field is not in the specified values.
Can be specified multiple times.
- --dist-xmax=s
-
Only return records where the 'dist' field is less than specified value.
- --dist-xmin=s
-
Only return records where the 'dist' field is greater than specified value.
- --dist=s
-
Only return records where the 'dist' field equals specified value.
Filtering for might_fail options
- --might-fail
-
Only return records where the 'might_fail' field equals specified value.
- --might-fail-is
-
Only return records where the 'might_fail' field equals specified value.
- --might-fail-isnt
-
Only return records where the 'might_fail' field does not equal specified value.
Filtering for prio options
- --prio-in-json=s
-
Only return records where the 'prio' field is in the specified values (JSON-encoded).
See
--prio-in
. - --prio-in=s@
-
Only return records where the 'prio' field is in the specified values.
Can be specified multiple times.
- --prio-is=s
-
Only return records where the 'prio' field equals specified value.
- --prio-isnt=s
-
Only return records where the 'prio' field does not equal specified value.
- --prio-max=s
-
Only return records where the 'prio' field is less than or equal to specified value.
- --prio-min=s
-
Only return records where the 'prio' field is greater than or equal to specified value.
- --prio-not-in-json=s
-
Only return records where the 'prio' field is not in the specified values (JSON-encoded).
See
--prio-not-in
. - --prio-not-in=s@
-
Only return records where the 'prio' field is not in the specified values.
Can be specified multiple times.
- --prio-xmax=s
-
Only return records where the 'prio' field is less than specified value.
- --prio-xmin=s
-
Only return records where the 'prio' field is greater than specified value.
- --prio=s
-
Only return records where the 'prio' field equals specified value.
Filtering for rule options
- --rule-contains=s
-
Only return records where the 'rule' field contains specified text.
- --rule-in-json=s
-
Only return records where the 'rule' field is in the specified values (JSON-encoded).
See
--rule-in
. - --rule-in=s@
-
Only return records where the 'rule' field is in the specified values.
Can be specified multiple times.
- --rule-is=s
-
Only return records where the 'rule' field equals specified value.
- --rule-isnt=s
-
Only return records where the 'rule' field does not equal specified value.
- --rule-max=s
-
Only return records where the 'rule' field is less than or equal to specified value.
- --rule-min=s
-
Only return records where the 'rule' field is greater than or equal to specified value.
- --rule-not-contains=s
-
Only return records where the 'rule' field does not contain specified text.
- --rule-not-in-json=s
-
Only return records where the 'rule' field is not in the specified values (JSON-encoded).
See
--rule-not-in
. - --rule-not-in=s@
-
Only return records where the 'rule' field is not in the specified values.
Can be specified multiple times.
- --rule-xmax=s
-
Only return records where the 'rule' field is less than specified value.
- --rule-xmin=s
-
Only return records where the 'rule' field is greater than specified value.
- --rule=s
-
Only return records where the 'rule' field equals specified value.
Filtering for summary options
- --summary-contains=s
-
Only return records where the 'summary' field contains specified text.
- --summary-in-json=s
-
Only return records where the 'summary' field is in the specified values (JSON-encoded).
See
--summary-in
. - --summary-in=s@
-
Only return records where the 'summary' field is in the specified values.
Can be specified multiple times.
- --summary-is=s
-
Only return records where the 'summary' field equals specified value.
- --summary-isnt=s
-
Only return records where the 'summary' field does not equal specified value.
- --summary-max=s
-
Only return records where the 'summary' field is less than or equal to specified value.
- --summary-min=s
-
Only return records where the 'summary' field is greater than or equal to specified value.
- --summary-not-contains=s
-
Only return records where the 'summary' field does not contain specified text.
- --summary-not-in-json=s
-
Only return records where the 'summary' field is not in the specified values (JSON-encoded).
See
--summary-not-in
. - --summary-not-in=s@
-
Only return records where the 'summary' field is not in the specified values.
Can be specified multiple times.
- --summary-xmax=s
-
Only return records where the 'summary' field is less than specified value.
- --summary-xmin=s
-
Only return records where the 'summary' field is greater than specified value.
- --summary=s
-
Only return records where the 'summary' field equals specified value.
Filtering for v options
- --v-arg=s
-
Only return records where the 'v' field equals specified value.
- --v-contains=s
-
Only return records where the 'v' field contains specified text.
- --v-in-json=s
-
Only return records where the 'v' field is in the specified values (JSON-encoded).
See
--v-in
. - --v-in=s@
-
Only return records where the 'v' field is in the specified values.
Can be specified multiple times.
- --v-is=s
-
Only return records where the 'v' field equals specified value.
- --v-isnt=s
-
Only return records where the 'v' field does not equal specified value.
- --v-max=s
-
Only return records where the 'v' field is less than or equal to specified value.
- --v-min=s
-
Only return records where the 'v' field is greater than or equal to specified value.
- --v-not-contains=s
-
Only return records where the 'v' field does not contain specified text.
- --v-not-in-json=s
-
Only return records where the 'v' field is not in the specified values (JSON-encoded).
See
--v-not-in
. - --v-not-in=s@
-
Only return records where the 'v' field is not in the specified values.
Can be specified multiple times.
- --v-xmax=s
-
Only return records where the 'v' field is less than specified value.
- --v-xmin=s
-
Only return records where the 'v' field is greater than specified value.
Filtering options
Ordering options
- --random
-
Return records in random order.
- --sort-json=s
-
Order records according to certain field(s) (JSON-encoded).
See
--sort
. - --sort=s@
-
Order records according to certain field(s).
A list of field names separated by comma. Each field can be prefixed with '-' to specify descending order instead of the default ascending.
Can be specified multiple times.
Output options
- --format=s
-
Choose output format, e.g. json, text.
Default value:
undef
- --json
-
Set output format to json.
- --naked-res
-
When outputing as JSON, strip result envelope.
Default value:
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]
- --page-result
-
Filter output through a pager.
- --view-result
-
View output using a viewer.
Paging options
- --result-limit=s
-
Only return a certain number of records.
- --result-start=s
-
Only return starting from the n'th record.
Default value:
1
Other options
COMPLETION
This script has shell tab completion capability with support for several shells.
bash
To activate bash completion for this script, put:
complete -C list-sah-coerce-rule-modules list-sah-coerce-rule-modules
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.
tcsh
To activate tcsh completion for this script, put:
complete list-sah-coerce-rule-modules 'p/*/`list-sah-coerce-rule-modules`/'
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.
CONFIGURATION FILE
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
): ~/.config/list-sah-coerce-rule-modules.conf, ~/list-sah-coerce-rule-modules.conf, or /etc/list-sah-coerce-rule-modules.conf.
All found files will be read and merged.
To disable searching for configuration files, pass --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
.
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.
You can also 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 equals some string: [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 some string: [env=HOSTNAME!=blink ...]
or [SOMESECTION env=HOSTNAME!=blink ...]
. If you only want a section to be read when the value of an environment variable includes some string: [env=HOSTNAME*=server ...]
or [SOMESECTION env=HOSTNAME*=server ...]
. If you only want a section to be read when the value of an environment variable does not include some string: [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.
To load and configure plugins, you can use either the -plugins
parameter (e.g. -plugins=DumpArgs
or -plugins=DumpArgs@before_validate_args
), or use the [plugin=NAME ...]
sections, for example:
[plugin=DumpArgs]
-event=before_validate_args
-prio=99
[plugin=Foo]
-event=after_validate_args
arg1=val1
arg2=val2
which is equivalent to setting -plugins=-DumpArgs@before_validate_args@99,-Foo@after_validate_args,arg1,val1,arg2,val2
.
List of available configuration parameters:
detail (see --detail)
dist (see --dist)
dist.contains (see --dist-contains)
dist.in (see --dist-in)
dist.is (see --dist-is)
dist.isnt (see --dist-isnt)
dist.max (see --dist-max)
dist.min (see --dist-min)
dist.not_contains (see --dist-not-contains)
dist.not_in (see --dist-not-in)
dist.xmax (see --dist-xmax)
dist.xmin (see --dist-xmin)
exclude_fields (see --exclude-field)
fields (see --field)
format (see --format)
might_fail (see --might-fail)
might_fail.is (see --might-fail-is)
might_fail.isnt (see --might-fail-isnt)
naked_res (see --naked-res)
prio (see --prio)
prio.in (see --prio-in)
prio.is (see --prio-is)
prio.isnt (see --prio-isnt)
prio.max (see --prio-max)
prio.min (see --prio-min)
prio.not_in (see --prio-not-in)
prio.xmax (see --prio-xmax)
prio.xmin (see --prio-xmin)
query (see --query)
random (see --random)
result_limit (see --result-limit)
result_start (see --result-start)
rule (see --rule)
rule.contains (see --rule-contains)
rule.in (see --rule-in)
rule.is (see --rule-is)
rule.isnt (see --rule-isnt)
rule.max (see --rule-max)
rule.min (see --rule-min)
rule.not_contains (see --rule-not-contains)
rule.not_in (see --rule-not-in)
rule.xmax (see --rule-xmax)
rule.xmin (see --rule-xmin)
sort (see --sort)
summary (see --summary)
summary.contains (see --summary-contains)
summary.in (see --summary-in)
summary.is (see --summary-is)
summary.isnt (see --summary-isnt)
summary.max (see --summary-max)
summary.min (see --summary-min)
summary.not_contains (see --summary-not-contains)
summary.not_in (see --summary-not-in)
summary.xmax (see --summary-xmax)
summary.xmin (see --summary-xmin)
v (see --v-arg)
v.contains (see --v-contains)
v.in (see --v-in)
v.is (see --v-is)
v.isnt (see --v-isnt)
v.max (see --v-max)
v.min (see --v-min)
v.not_contains (see --v-not-contains)
v.not_in (see --v-not-in)
v.xmax (see --v-xmax)
v.xmin (see --v-xmin)
with_field_names (see --with-field-names)
ENVIRONMENT
LIST_SAH_COERCE_RULE_MODULES_OPT => str
Specify additional command-line options.
FILES
~/.config/list-sah-coerce-rule-modules.conf
~/list-sah-coerce-rule-modules.conf
/etc/list-sah-coerce-rule-modules.conf
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-SahUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-SahUtils.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-SahUtils
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.
SEE ALSO
<show-sah-coerce-module>
AUTHOR
perlancar <perlancar@cpan.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2021, 2020, 2019, 2018, 2017, 2016, 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.