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

NAME

list-sah-filter-rule-modules - List Sah coerce rule modules

VERSION

This document describes version 0.476 of list-sah-filter-rule-modules (from Perl distribution App-SahUtils), released on 2020-02-12.

SYNOPSIS

Usage:

 % list-sah-filter-rule-modules [options] [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

--no-env

Do not read environment for default 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

--query=s, -q

Search.

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.

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

--help, -h, -?

Display help message and exit.

--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 list-sah-filter-rule-modules list-sah-filter-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-filter-rule-modules 'p/*/`list-sah-filter-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-filter-rule-modules.conf, ~/list-sah-filter-rule-modules.conf, or /etc/list-sah-filter-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.

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.

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_FILTER_RULE_MODULES_OPT => str

Specify additional command-line options.

FILES

~/.config/list-sah-filter-rule-modules.conf

~/list-sah-filter-rule-modules.conf

/etc/list-sah-filter-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-filter-module>

AUTHOR

perlancar <perlancar@cpan.org>

COPYRIGHT AND LICENSE

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