App-orgadb

 view release on metacpan or  search on metacpan

lib/App/orgadb/Common.pm  view on Meta::CPAN

        tags => ['category:output'],
    },
    field_value_formatters => {
        'x.name.is_plural' => 1,
        'x.name.singular' => 'field_value_formatter',
        summary => 'Add one or more formatters to display field value',
        #schema => ['array*', of=>'perl::perl_sah_filter::modname_with_optional_args*'], ## doesn't work yet with Perinci::Sub::GetArgs::Argv
        schema => ['array*', of=>[
            'str*', {
                prefilters=>['Perl::normalize_perl_modname'],
                'x.completion' => ['perl_perl_sah_filter_modname_with_optional_args'],
            }],
               ],
        cmdline_aliases => {
            fvfmt=>{},
            f=>{},
            remove_nondigits   => {is_flag=>1, summary=>'Shortcut for --field-value-formatter Str::remove_nondigit'   , code=>sub { $_[0]{field_value_formatters} //= []; push @{ $_[0]{field_value_formatters} }, 'Str::remove_nondigit'   } },
            remove_comments    => {is_flag=>1, summary=>'Shortcut for --field-value-formatter Str::remove_comment'    , code=>sub { $_[0]{field_value_formatters} //= []; push @{ $_[0]{field_value_formatters} }, 'Str::remove_comment'    } },
            remove_whitespaces => {is_flag=>1, summary=>'Shortcut for --field-value-formatter Str::remove_whitespaces', code=>sub { $_[0]{field_value_formatters} //= []; push @{ $_[0]{field_value_formatters} }, 'Str::remove_whitespace' } },
            format_phone       => {is_flag=>1, summary=>'Shortcut for --field-value-formatter Phone::format'          , code=>sub { $_[0]{field_value_formatters} //= []; push @{ $_[0]{field_value_formatters} }, 'Phone::format'          } },
        },
        tags => ['category:output'],
        description => <<'MARKDOWN',

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 `--field-value-formatter-rules` but is
overridden by the `--no-field-value-formatters` (`--raw-field-values`, `-F`)
option.

MARKDOWN
    },

    num_entries => {
        summary => 'Specify maximum number of entries to return (0 means unlimited)',
        schema => 'uint*',
        tags => ['category:output'],
    },
    num_fields => {
        summary => 'Specify maximum number of fields (per entry) to return (0 means unlimited)',
        schema => 'uint*',
        cmdline_aliases => {
            n=>{},
            1 => {is_flag=>1, summary=>'Shortcut for --num-fields=1', code=>sub { $_[0]{num_fields} = 1 }},
        },
        tags => ['category:output'],
    },

    clipboard => {
        summary => 'Whether to copy matching field values to clipboard',
        schema => ['str*', in=>[qw/tee only/]],
        description => <<'MARKDOWN',

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.

Mnemonic for short option `-y` and `-Y`: *y*ank as in Emacs (`C-y`).

MARKDOWN
        cmdline_aliases => {
            clipboard_only => {is_flag=>1, summary=>'Shortcut for --clipboard=only', code=>sub { $_[0]{clipboard} = 'only' }},
            y => {is_flag=>1, summary=>'Shortcut for --clipboard=tee', code=>sub { $_[0]{clipboard} = 'tee' }},
            Y => {is_flag=>1, summary=>'Shortcut for --clipboard=only', code=>sub { $_[0]{clipboard} = 'only' }},
        },
        tags => ['category:output'],
    },
);

1;
# ABSTRACT:

__END__

=pod

=encoding UTF-8

=head1 NAME

App::orgadb::Common

=head1 VERSION

This document describes version 0.020 of App::orgadb::Common (from Perl distribution App-orgadb), released on 2025-06-19.

=head1 HOMEPAGE

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

=head1 SOURCE

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

=head1 AUTHOR

perlancar <perlancar@cpan.org>

=head1 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 L<Dist::Zilla>,
L<Dist::Zilla::PluginBundle::Author::PERLANCAR>,
L<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.

=head1 COPYRIGHT AND LICENSE

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

=head1 BUGS



( run in 1.588 second using v1.01-cache-2.11-cpan-2398b32b56e )