NAME

App::orgadb::Select::Shell::Commands - orgadb-sel shell commands

VERSION

This document describes version 0.010 of App::orgadb::Select::Shell::Commands (from Perl distribution App-orgadb), released on 2022-10-09.

FUNCTIONS

history

Usage:

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

Show shell history.

This function is not exported.

Arguments ('*' denotes required arguments):

  • append => bool

    Append current session's history to history file.

  • clear => bool

    Clear history.

  • read => bool

    (Re-)read history from file.

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)

select

Usage:

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

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

  • count => true

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

  • default_formatter_rules => array[any]

    Specify conditional default formatters. This is for convenience and best specified in the configuration as opposed to on the command-line option. An example:

    default_formatter_rules={"field_name_matches":"/phone|wa|whatsapp/i","formatters":[ ["Phone::format_phone_idn"] ]}
  • detail => bool

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

  • 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'}]

    Overrides --default_formatter_rule but 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).

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

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>

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.