NAME
    App::orgadb - An opinionated Org addressbook toolset

VERSION
    This document describes version 0.012 of App::orgadb (from Perl
    distribution App-orgadb), released on 2022-10-15.

SYNOPSIS
DESCRIPTION
    This distribution includes the following CLI's:

    *   orgadb-sel

FUNCTIONS
  select
    Usage:

     select(%args) -> [$status_code, $reason, $payload, \%result_meta]

    Select Org addressbook entries/fields/subfields.

    This function is not exported.

    Arguments ('*' denotes required arguments):

    *   category => *str_or_re*

        Find entry by string or regex search against the category title.

    *   clipboard => *str*

        Whether to copy matching field values to clipboard.

        If set to "tee", then will display matching fields to terminal as
        well as copy matching field values to clipboard.

        If set to "only", then will not display matching fields to terminal
        and will only copy matching field values to clipboard.

    *   color => *str* (default: "auto")

        Whether to use color.

    *   color_theme => *perl::colortheme::modname_with_optional_args*

        (No description)

    *   count => *true*

        Return just the number of matching entries instead of showing them.

    *   default_formatter_rules => *array[hash]*

        Specify conditional default formatters, as an array of hashes. Each
        element is a rule that is specified as a hash containing condition
        keys and formatters keys. If all conditions are met then the
        formatters will be applied. The rules will be tested when each field
        is about to be outputted. Multiple rules can match and the matching
        rules' formatters are all applied in succession.

        Note that this option will be overridden by the "--formatter" or the
        "--no-formatters" ("-F") option.

        Default formatters are best specified in the configuration as
        opposed to on the command-line option. An example (the lines below
        are writen in configuration file in IOD syntax, as rows of JSON
        hashes):

         ; by default remove all comments in field values when 'hide_field_name'
         ; option is set (which usually means we want to copy paste things)
         default_formatter_rules={"hide_field_name":true, "formatters":[ ["Str::remove_comment"] ]}
 
         ; by default normalize phone numbers using Phone::format_phone_idn_nospace
         ; when 'hide_field_name' option is set (which usually means we want to copy
         ; paste things). e.g. '0812-1234-5678' becomes '+6281212345678'.
         default_formatter_rules={"field_name_matches":"/phone|wa|whatsapp/i", "hide_field_name":true, "formatters":[ ["Phone::format_phone_idn_nospace"] ]}
 
         ; but if 'hide_field_name' field is not set, normalize phone numbers using
         ; Phone::format_phone_idn which is more easier to see (e.g. '+62 812 1234
         ; 5678').
         default_formatter_rules={"field_name_matches":"/phone|wa|whatsapp/i", "hide_field_name":false, "formatters":[ ["Phone::format_phone_idn"] ]}

        Condition keys:

        *   "field_name_matches" (value: str/re): Check if field name
            matches a regex pattern.

        *   "hide_field_name" (value: bool): Check if "--hide-field-name"
            ("-N") option is set (true) or unset (false).

        Formatter keys:

        *   "formatters": an array of formatters, to be applied. Each
            formatter is a name of perl Sah filter rule, or a two-element
            array of perl Sah filter rule name followed by hash containing
            arguments. See "--formatter" for more detais on specifying
            formatter.

    *   detail => *bool*

        (No description)

    *   entry => *str_or_re*

        Find entry by string or regex search against its title.

    *   fields => *array[str_or_re]*

        Find (sub)fields by string or regex search.

    *   files => *array[filename]*

        Path to addressbook files.

    *   filter_entries_by_fields => *array[str]*

        Find entry by the fields or subfields it has.

        The format of each entry_by_field is one of:

         str
         /re/
         str = str2
         str = /re2/
         /re/ = str2
         /re/ = /re2/

        That is, it can search for a string ("str") or regex ("re") in the
        field name, and optionally also search for a string ("str2") or
        regex ("re2") in the field value.

    *   formatters => *array[str]*

        Add one or more formatters to display field value.

        Specify one or more formatters to apply to the field value before
        displaying.

        A formatter is name of "Data::Sah::Filter::perl::*" module, without
        the prefix. For example: "Str::uc" will convert the field value to
        uppercase. Another formatter, "Str::remove_comment" can remove
        comment.

        A formatter can have arguments, which is specified using this
        format:

         [FORMATTER_NAME, {ARG1NAME => ARG1VAL, ...}]

        If formatter name begins with "[" character, it will be parsed as
        JSON. Example:

         ['Str::remove_comment', {'style':'cpp'}]

        Note that this option overrides "--default-formatter-rules" but is
        overridden by the "--no-formatters" ("--raw-field-values", "-F")
        option.

    *   hide_category => *true*

        Do not show category.

    *   hide_entry => *true*

        Do not show entry headline.

    *   hide_field_name => *true*

        Do not show field names, just show field values.

    *   no_formatters => *true*

        Do not apply any formatters to field value (overrides --formatter
        option).

        Note that this option has higher precedence than
        "--default-formatter-rules" or the "--formatter" option.

    *   num_entries => *uint*

        Specify maximum number of entries to return (0 means unlimited).

    *   num_fields => *uint*

        Specify maximum number of fields (per entry) to return (0 means
        unlimited).

    *   reload_files_on_change => *bool* (default: 1)

        (No description)

    *   shell => *true*

        (No description)

    Returns an enveloped result (an array).

    First element ($status_code) is an integer containing HTTP-like status
    code (200 means OK, 4xx caller error, 5xx function error). Second
    element ($reason) is a string containing error message, or something
    like "OK" if status is 200. Third element ($payload) is the actual
    result, but usually not present when enveloped result is an error
    response ($status_code is not 2xx). Fourth element (%result_meta) is
    called result metadata and is optional, a hash that contains extra
    information, much like how HTTP response headers provide additional
    metadata.

    Return value: (any)

HOMEPAGE
    Please visit the project's homepage at
    <https://metacpan.org/release/App-orgadb>.

SOURCE
    Source repository is at <https://github.com/perlancar/perl-App-orgadb>.

AUTHOR
    perlancar <perlancar@cpan.org>

CONTRIBUTOR
    Steven Haryanto <stevenharyanto@gmail.com>

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) 2022 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-orgadb>

    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.

