NAME
list-idn-localities - Localities (cities & regencies) in Indonesia
VERSION
This document describes version 0.02 of list-idn-localities (from Perl distribution App-IndonesianLocaleUtils), released on 2021-05-07.
SYNOPSIS
Usage:
% list-idn-localities [--bps-code-in-json=s] [--bps-code-in=s+]
[--bps-code-is=s] [--bps-code-isnt=s] [--bps-code-max=s]
[--bps-code-min=s] [--bps-code-not-in-json=s] [--bps-code-not-in=s+]
[--bps-code-xmax=s] [--bps-code-xmin=s] [--bps-code=s]
[--bps-prov-code-in-json=s] [--bps-prov-code-in=s+]
[--bps-prov-code-is=s] [--bps-prov-code-isnt=s]
[--bps-prov-code-max=s] [--bps-prov-code-min=s]
[--bps-prov-code-not-in-json=s] [--bps-prov-code-not-in=s+]
[--bps-prov-code-xmax=s] [--bps-prov-code-xmin=s] [--bps-prov-code=s]
[--config-path=path | -c] [--config-profile=profile | -P] [--detail]
[--exclude-field=s+] [--exclude-fields-json=s] [--field=s+]
[--fields-json=s] [--format=name] [--ind-name-contains=s]
[--ind-name-in-json=s] [--ind-name-in=s+] [--ind-name-is=s]
[--ind-name-isnt=s] [--ind-name-max=s] [--ind-name-min=s]
[--ind-name-not-contains=s] [--ind-name-not-in-json=s]
[--ind-name-not-in=s+] [--ind-name-xmax=s] [--ind-name-xmin=s]
[--ind-name=s] [--json] [-l] [--(no)naked-res] [--no-config | -C]
[--no-detail] [--no-env] [--no-random] [--nodetail] [--norandom]
[--page-result[=program]] [--random] [--result-limit=s]
[--result-start=s] [--sort-json=s] [--sort=s+] [--type-in-json=s]
[--type-in=s+] [--type-is=s] [--type-isnt=s] [--type-max=s]
[--type-min=s] [--type-not-in-json=s] [--type-not-in=s+]
[--type-xmax=s] [--type-xmin=s] [--type=s] [--view-result[=program]]
[--with-field-names] [--without-field-names] [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.
Default value:
["ind_name"]
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 bps_code options
- --bps-code-in-json=s
-
Only return records where the 'bps_code' field is in the specified values (JSON-encoded).
See
--bps-code-in
. - --bps-code-in=s@
-
Only return records where the 'bps_code' field is in the specified values.
Can be specified multiple times.
- --bps-code-is=s
-
Only return records where the 'bps_code' field equals specified value.
- --bps-code-isnt=s
-
Only return records where the 'bps_code' field does not equal specified value.
- --bps-code-max=s
-
Only return records where the 'bps_code' field is less than or equal to specified value.
- --bps-code-min=s
-
Only return records where the 'bps_code' field is greater than or equal to specified value.
- --bps-code-not-in-json=s
-
Only return records where the 'bps_code' field is not in the specified values (JSON-encoded).
See
--bps-code-not-in
. - --bps-code-not-in=s@
-
Only return records where the 'bps_code' field is not in the specified values.
Can be specified multiple times.
- --bps-code-xmax=s
-
Only return records where the 'bps_code' field is less than specified value.
- --bps-code-xmin=s
-
Only return records where the 'bps_code' field is greater than specified value.
- --bps-code=s
-
Only return records where the 'bps_code' field equals specified value.
Filtering for bps_prov_code options
- --bps-prov-code-in-json=s
-
Only return records where the 'bps_prov_code' field is in the specified values (JSON-encoded).
See
--bps-prov-code-in
. - --bps-prov-code-in=s@
-
Only return records where the 'bps_prov_code' field is in the specified values.
Can be specified multiple times.
- --bps-prov-code-is=s
-
Only return records where the 'bps_prov_code' field equals specified value.
- --bps-prov-code-isnt=s
-
Only return records where the 'bps_prov_code' field does not equal specified value.
- --bps-prov-code-max=s
-
Only return records where the 'bps_prov_code' field is less than or equal to specified value.
- --bps-prov-code-min=s
-
Only return records where the 'bps_prov_code' field is greater than or equal to specified value.
- --bps-prov-code-not-in-json=s
-
Only return records where the 'bps_prov_code' field is not in the specified values (JSON-encoded).
See
--bps-prov-code-not-in
. - --bps-prov-code-not-in=s@
-
Only return records where the 'bps_prov_code' field is not in the specified values.
Can be specified multiple times.
- --bps-prov-code-xmax=s
-
Only return records where the 'bps_prov_code' field is less than specified value.
- --bps-prov-code-xmin=s
-
Only return records where the 'bps_prov_code' field is greater than specified value.
- --bps-prov-code=s
-
Only return records where the 'bps_prov_code' field equals specified value.
Filtering for ind_name options
- --ind-name-contains=s
-
Only return records where the 'ind_name' field contains specified text.
- --ind-name-in-json=s
-
Only return records where the 'ind_name' field is in the specified values (JSON-encoded).
See
--ind-name-in
. - --ind-name-in=s@
-
Only return records where the 'ind_name' field is in the specified values.
Can be specified multiple times.
- --ind-name-is=s
-
Only return records where the 'ind_name' field equals specified value.
- --ind-name-isnt=s
-
Only return records where the 'ind_name' field does not equal specified value.
- --ind-name-max=s
-
Only return records where the 'ind_name' field is less than or equal to specified value.
- --ind-name-min=s
-
Only return records where the 'ind_name' field is greater than or equal to specified value.
- --ind-name-not-contains=s
-
Only return records where the 'ind_name' field does not contain specified text.
- --ind-name-not-in-json=s
-
Only return records where the 'ind_name' field is not in the specified values (JSON-encoded).
See
--ind-name-not-in
. - --ind-name-not-in=s@
-
Only return records where the 'ind_name' field is not in the specified values.
Can be specified multiple times.
- --ind-name-xmax=s
-
Only return records where the 'ind_name' field is less than specified value.
- --ind-name-xmin=s
-
Only return records where the 'ind_name' field is greater than specified value.
- --ind-name=s
-
Only return records where the 'ind_name' field equals specified value.
Filtering for type options
- --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-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-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-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
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-idn-localities list-idn-localities
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-idn-localities 'p/*/`list-idn-localities`/'
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-idn-localities.conf, ~/list-idn-localities.conf, or /etc/list-idn-localities.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 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.
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:
bps_code (see --bps-code)
bps_code.in (see --bps-code-in)
bps_code.is (see --bps-code-is)
bps_code.isnt (see --bps-code-isnt)
bps_code.max (see --bps-code-max)
bps_code.min (see --bps-code-min)
bps_code.not_in (see --bps-code-not-in)
bps_code.xmax (see --bps-code-xmax)
bps_code.xmin (see --bps-code-xmin)
bps_prov_code (see --bps-prov-code)
bps_prov_code.in (see --bps-prov-code-in)
bps_prov_code.is (see --bps-prov-code-is)
bps_prov_code.isnt (see --bps-prov-code-isnt)
bps_prov_code.max (see --bps-prov-code-max)
bps_prov_code.min (see --bps-prov-code-min)
bps_prov_code.not_in (see --bps-prov-code-not-in)
bps_prov_code.xmax (see --bps-prov-code-xmax)
bps_prov_code.xmin (see --bps-prov-code-xmin)
detail (see --detail)
exclude_fields (see --exclude-field)
fields (see --field)
format (see --format)
ind_name (see --ind-name)
ind_name.contains (see --ind-name-contains)
ind_name.in (see --ind-name-in)
ind_name.is (see --ind-name-is)
ind_name.isnt (see --ind-name-isnt)
ind_name.max (see --ind-name-max)
ind_name.min (see --ind-name-min)
ind_name.not_contains (see --ind-name-not-contains)
ind_name.not_in (see --ind-name-not-in)
ind_name.xmax (see --ind-name-xmax)
ind_name.xmin (see --ind-name-xmin)
naked_res (see --naked-res)
query (see --query)
random (see --random)
result_limit (see --result-limit)
result_start (see --result-start)
sort (see --sort)
type (see --type)
type.in (see --type-in)
type.is (see --type-is)
type.isnt (see --type-isnt)
type.max (see --type-max)
type.min (see --type-min)
type.not_in (see --type-not-in)
type.xmax (see --type-xmax)
type.xmin (see --type-xmin)
with_field_names (see --with-field-names)
ENVIRONMENT
LIST_IDN_LOCALITIES_OPT => str
Specify additional command-line options.
FILES
~/.config/list-idn-localities.conf
~/list-idn-localities.conf
/etc/list-idn-localities.conf
HOMEPAGE
Please visit the project's homepage at https://metacpan.org/release/App-IndonesianLocaleUtils.
SOURCE
Source repository is at https://github.com/perlancar/perl-App-IndonesianLocaleUtils.
BUGS
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=App-IndonesianLocaleUtils
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) 2021, 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.