NAME

bpom-list-food-ingredients - List ingredients in BPOM processed food division

VERSION

This document describes version 0.019 of bpom-list-food-ingredients (from Perl distribution App-BPOMUtils-Table-FoodIngredient), released on 2023-02-13.

SYNOPSIS

bpom-list-food-ingredients --help (or -h, -?)

bpom-list-food-ingredients --version (or -v)

bpom-list-food-ingredients [--country-of-origin-contains=str] [(--country-of-origin-in=str)+|--country-of-origin-in-json=json] [--country-of-origin-is=str] [--country-of-origin-isnt=str] [--country-of-origin-matches=str] [--country-of-origin-max=str] [--country-of-origin-min=str] [--country-of-origin-not-contains=str] [(--country-of-origin-not-in=str)+|--country-of-origin-not-in-json=json] [--country-of-origin-not-matches=str] [--country-of-origin-xmax=str] [--country-of-origin-xmin=str] [--country-of-origin=str] [--debug|--log-level=level|--quiet|--trace|--verbose] [--detail|-l|--no-detail|--nodetail] [(--exclude-field=str)+|--exclude-fields-json=json] [(--field=str)+|--fields-json=json] [--format=name|--json] [(--id-in=int)+|--id-in-json=json] [--id-is=int] [--id-isnt=int] [--id-max=int] [--id-min=int] [(--id-not-in=int)+|--id-not-in-json=json] [--id-xmax=int] [--id-xmin=int] [--id=int] [--is-herbal-contains=str] [(--is-herbal-in=str)+|--is-herbal-in-json=json] [--is-herbal-is=str] [--is-herbal-isnt=str] [--is-herbal-matches=str] [--is-herbal-max=str] [--is-herbal-min=str] [--is-herbal-not-contains=str] [(--is-herbal-not-in=str)+|--is-herbal-not-in-json=json] [--is-herbal-not-matches=str] [--is-herbal-xmax=str] [--is-herbal-xmin=str] [--is-herbal=str] [--(no)naked-res] [--name-contains=str] [(--name-in=str)+|--name-in-json=json] [--name-is=str] [--name-isnt=str] [--name-matches=str] [--name-max=str] [--name-min=str] [--name-not-contains=str] [(--name-not-in=str)+|--name-not-in-json=json] [--name-not-matches=str] [--name-xmax=str] [--name-xmin=str] [--name=str] [--origin-contains=str] [(--origin-in=str)+|--origin-in-json=json] [--origin-is=str] [--origin-isnt=str] [--origin-matches=str] [--origin-max=str] [--origin-min=str] [--origin-not-contains=str] [(--origin-not-in=str)+|--origin-not-in-json=json] [--origin-not-matches=str] [--origin-xmax=str] [--origin-xmin=str] [--origin=str] [--page-result[=program]|--view-result[=program]] [--query-boolean=str|--and|--or] [(--query=str)+|--queries-json=json|(-q=str)+] [--random|--no-random|--norandom] [--result-limit=int] [--result-start=int] [(--sort=str)+|--sort-json=json] [--status-contains=str] [(--status-in=str)+|--status-in-json=json] [--status-is=str] [--status-isnt=str] [--status-matches=str] [--status-max=str] [--status-min=str] [--status-not-contains=str] [(--status-not-in=str)+|--status-not-in-json=json] [--status-not-matches=str] [--status-xmax=str] [--status-xmin=str] [--status=str] [--type-contains=str] [(--type-in=str)+|--type-in-json=json] [--type-is=str] [--type-isnt=str] [--type-matches=str] [--type-max=str] [--type-min=str] [--type-not-contains=str] [(--type-not-in=str)+|--type-not-in-json=json] [--type-not-matches=str] [--type-xmax=str] [--type-xmin=str] [--type=str] [--with-field-names|--without-field-names] -- [query] ...

OPTIONS

* marks required 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 country_of_origin options

--country-of-origin-contains=s

Only return records where the 'country_of_origin' field contains specified text.

--country-of-origin-in-json=s

Only return records where the 'country_of_origin' field is in the specified values (JSON-encoded).

See --country-of-origin-in.

--country-of-origin-in=s@

Only return records where the 'country_of_origin' field is in the specified values.

Can be specified multiple times.

--country-of-origin-is=s

Only return records where the 'country_of_origin' field equals specified value.

--country-of-origin-isnt=s

Only return records where the 'country_of_origin' field does not equal specified value.

--country-of-origin-matches=s

Only return records where the 'country_of_origin' field matches specified regular expression pattern.

--country-of-origin-max=s

Only return records where the 'country_of_origin' field is less than or equal to specified value.

--country-of-origin-min=s

Only return records where the 'country_of_origin' field is greater than or equal to specified value.

--country-of-origin-not-contains=s

Only return records where the 'country_of_origin' field does not contain specified text.

--country-of-origin-not-in-json=s

Only return records where the 'country_of_origin' field is not in the specified values (JSON-encoded).

See --country-of-origin-not-in.

--country-of-origin-not-in=s@

Only return records where the 'country_of_origin' field is not in the specified values.

Can be specified multiple times.

--country-of-origin-not-matches=s

Only return records where the 'country_of_origin' field does not match specified regular expression.

--country-of-origin-xmax=s

Only return records where the 'country_of_origin' field is less than specified value.

--country-of-origin-xmin=s

Only return records where the 'country_of_origin' field is greater than specified value.

--country-of-origin=s

Only return records where the 'country_of_origin' field equals specified value.

Filtering for id options

--id-in-json=s

Only return records where the 'id' field is in the specified values (JSON-encoded).

See --id-in.

--id-in=s@

Only return records where the 'id' field is in the specified values.

Can be specified multiple times.

--id-is=s

Only return records where the 'id' field equals specified value.

--id-isnt=s

Only return records where the 'id' field does not equal specified value.

--id-max=s

Only return records where the 'id' field is less than or equal to specified value.

--id-min=s

Only return records where the 'id' field is greater than or equal to specified value.

--id-not-in-json=s

Only return records where the 'id' field is not in the specified values (JSON-encoded).

See --id-not-in.

--id-not-in=s@

Only return records where the 'id' field is not in the specified values.

Can be specified multiple times.

--id-xmax=s

Only return records where the 'id' field is less than specified value.

--id-xmin=s

Only return records where the 'id' field is greater than specified value.

--id=s

Only return records where the 'id' field equals specified value.

Filtering for is_herbal options

--is-herbal-contains=s

Only return records where the 'is_herbal' field contains specified text.

--is-herbal-in-json=s

Only return records where the 'is_herbal' field is in the specified values (JSON-encoded).

See --is-herbal-in.

--is-herbal-in=s@

Only return records where the 'is_herbal' field is in the specified values.

Can be specified multiple times.

--is-herbal-is=s

Only return records where the 'is_herbal' field equals specified value.

--is-herbal-isnt=s

Only return records where the 'is_herbal' field does not equal specified value.

--is-herbal-matches=s

Only return records where the 'is_herbal' field matches specified regular expression pattern.

--is-herbal-max=s

Only return records where the 'is_herbal' field is less than or equal to specified value.

--is-herbal-min=s

Only return records where the 'is_herbal' field is greater than or equal to specified value.

--is-herbal-not-contains=s

Only return records where the 'is_herbal' field does not contain specified text.

--is-herbal-not-in-json=s

Only return records where the 'is_herbal' field is not in the specified values (JSON-encoded).

See --is-herbal-not-in.

--is-herbal-not-in=s@

Only return records where the 'is_herbal' field is not in the specified values.

Can be specified multiple times.

--is-herbal-not-matches=s

Only return records where the 'is_herbal' field does not match specified regular expression.

--is-herbal-xmax=s

Only return records where the 'is_herbal' field is less than specified value.

--is-herbal-xmin=s

Only return records where the 'is_herbal' field is greater than specified value.

--is-herbal=s

Only return records where the 'is_herbal' field equals specified value.

Filtering for name options

--name-contains=s

Only return records where the 'name' field contains specified text.

--name-in-json=s

Only return records where the 'name' field is in the specified values (JSON-encoded).

See --name-in.

--name-in=s@

Only return records where the 'name' field is in the specified values.

Can be specified multiple times.

--name-is=s

Only return records where the 'name' field equals specified value.

--name-isnt=s

Only return records where the 'name' field does not equal specified value.

--name-matches=s

Only return records where the 'name' field matches specified regular expression pattern.

--name-max=s

Only return records where the 'name' field is less than or equal to specified value.

--name-min=s

Only return records where the 'name' field is greater than or equal to specified value.

--name-not-contains=s

Only return records where the 'name' field does not contain specified text.

--name-not-in-json=s

Only return records where the 'name' field is not in the specified values (JSON-encoded).

See --name-not-in.

--name-not-in=s@

Only return records where the 'name' field is not in the specified values.

Can be specified multiple times.

--name-not-matches=s

Only return records where the 'name' field does not match specified regular expression.

--name-xmax=s

Only return records where the 'name' field is less than specified value.

--name-xmin=s

Only return records where the 'name' field is greater than specified value.

--name=s

Only return records where the 'name' field equals specified value.

Filtering for origin options

--origin-contains=s

Only return records where the 'origin' field contains specified text.

--origin-in-json=s

Only return records where the 'origin' field is in the specified values (JSON-encoded).

See --origin-in.

--origin-in=s@

Only return records where the 'origin' field is in the specified values.

Can be specified multiple times.

--origin-is=s

Only return records where the 'origin' field equals specified value.

--origin-isnt=s

Only return records where the 'origin' field does not equal specified value.

--origin-matches=s

Only return records where the 'origin' field matches specified regular expression pattern.

--origin-max=s

Only return records where the 'origin' field is less than or equal to specified value.

--origin-min=s

Only return records where the 'origin' field is greater than or equal to specified value.

--origin-not-contains=s

Only return records where the 'origin' field does not contain specified text.

--origin-not-in-json=s

Only return records where the 'origin' field is not in the specified values (JSON-encoded).

See --origin-not-in.

--origin-not-in=s@

Only return records where the 'origin' field is not in the specified values.

Can be specified multiple times.

--origin-not-matches=s

Only return records where the 'origin' field does not match specified regular expression.

--origin-xmax=s

Only return records where the 'origin' field is less than specified value.

--origin-xmin=s

Only return records where the 'origin' field is greater than specified value.

--origin=s

Only return records where the 'origin' field equals specified value.

Filtering for status options

--status-contains=s

Only return records where the 'status' field contains specified text.

--status-in-json=s

Only return records where the 'status' field is in the specified values (JSON-encoded).

See --status-in.

--status-in=s@

Only return records where the 'status' field is in the specified values.

Can be specified multiple times.

--status-is=s

Only return records where the 'status' field equals specified value.

--status-isnt=s

Only return records where the 'status' field does not equal specified value.

--status-matches=s

Only return records where the 'status' field matches specified regular expression pattern.

--status-max=s

Only return records where the 'status' field is less than or equal to specified value.

--status-min=s

Only return records where the 'status' field is greater than or equal to specified value.

--status-not-contains=s

Only return records where the 'status' field does not contain specified text.

--status-not-in-json=s

Only return records where the 'status' field is not in the specified values (JSON-encoded).

See --status-not-in.

--status-not-in=s@

Only return records where the 'status' field is not in the specified values.

Can be specified multiple times.

--status-not-matches=s

Only return records where the 'status' field does not match specified regular expression.

--status-xmax=s

Only return records where the 'status' field is less than specified value.

--status-xmin=s

Only return records where the 'status' field is greater than specified value.

--status=s

Only return records where the 'status' field equals specified value.

Filtering for type options

--type-contains=s

Only return records where the 'type' field contains specified text.

--type-in-json=s

Only return records where the 'type' field is in the specified values (JSON-encoded).

See --type-in.

--type-in=s@

Only return records where the 'type' field is in the specified values.

Can be specified multiple times.

--type-is=s

Only return records where the 'type' field equals specified value.

--type-isnt=s

Only return records where the 'type' field does not equal specified value.

--type-matches=s

Only return records where the 'type' field matches specified regular expression pattern.

--type-max=s

Only return records where the 'type' field is less than or equal to specified value.

--type-min=s

Only return records where the 'type' field is greater than or equal to specified value.

--type-not-contains=s

Only return records where the 'type' field does not contain specified text.

--type-not-in-json=s

Only return records where the 'type' field is not in the specified values (JSON-encoded).

See --type-not-in.

--type-not-in=s@

Only return records where the 'type' field is not in the specified values.

Can be specified multiple times.

--type-not-matches=s

Only return records where the 'type' field does not match specified regular expression.

--type-xmax=s

Only return records where the 'type' field is less than specified value.

--type-xmin=s

Only return records where the 'type' field is greater than specified value.

--type=s

Only return records where the 'type' field equals specified value.

Filtering options

--and

Shortcut for --query-boolean=and.

See --query-boolean.

--or

Shortcut for --query-boolean=or.

See --query-boolean.

--queries-json=s, -q

Search (JSON-encoded).

See --query.

Can also be specified as the 1st command-line argument and onwards.

--query-boolean=s

Whether records must match all search queries ('and') or just one ('or').

Default value:

"and"

Valid values:

["and","or"]

If set to and, all queries must match; if set to or, only one query should match. See the queries option for more details on searching.

--query=s@

Search.

This will search all searchable fields with one or more specified queries. Each query can be in the form of -FOO (dash prefix notation) to require that the fields do not contain specified string, or /FOO/ to use regular expression. All queries must match if the query_boolean option is set to and; only one query should match if the query_boolean option is set to or.

Can also be specified as the 1st command-line argument and onwards.

Can be specified multiple times.

Logging options

--debug

Shortcut for --log-level=debug.

--log-level=s

Set log level.

By default, these log levels are available (in order of increasing level of importance, from least important to most): trace, debug, info, warn/warning, error, fatal. By default, the level is usually set to warn, which means that log statements with level info and less important levels will not be shown. To increase verbosity, choose info, debug, or trace.

For more details on log level and logging, as well as how new logging levels can be defined or existing ones modified, see Log::ger.

--quiet

Shortcut for --log-level=error.

--trace

Shortcut for --log-level=trace.

--verbose

Shortcut for --log-level=info.

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

Output can be displayed in multiple formats, and a suitable default format is chosen depending on the application and/or whether output destination is interactive terminal (i.e. whether output is piped). This option specifically chooses an output format.

--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.

This option will pipe the output to a specified pager program. If pager program is not specified, a suitable default e.g. less is chosen.

--view-result

View output using a viewer.

This option will first save the output to a temporary file, then open a viewer program to view the temporary file. If a viewer program is not chosen, a suitable default, e.g. the browser, is chosen.

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 bpom-list-food-ingredients bpom-list-food-ingredients

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 bpom-list-food-ingredients 'p/*/`bpom-list-food-ingredients`/'

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.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/App-BPOMUtils-Table-FoodIngredient.

SOURCE

Source repository is at https://github.com/perlancar/perl-App-BPOMUtils-Table-FoodIngredient.

AUTHOR

perlancar <perlancar@cpan.org>

CONTRIBUTING

To contribute, you can send patches by email/via RT, or send pull requests on GitHub.

Most of the time, you don't need to build the distribution yourself. You can simply modify the code, then test via:

% prove -l

If you want to build the distribution (e.g. to try to install it locally on your system), you can install Dist::Zilla, Dist::Zilla::PluginBundle::Author::PERLANCAR, Pod::Weaver::PluginBundle::Author::PERLANCAR, and sometimes one or two other Dist::Zilla- and/or Pod::Weaver plugins. Any additional steps required beyond that are considered a bug and can be reported to me.

COPYRIGHT AND LICENSE

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

BUGS

Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-BPOMUtils-Table-FoodIngredient

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.