App-orgadb

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

        - [incompatible change] Rename CLI orgadb to orgadb-sel.

        - Add option --filter-entries-by-field work.

        - [bugfix] Field searching must be from the root field and not
          subfields.


0.004   2022-07-04  Released-By: PERLANCAR; Urgency: medium

        - Decrypt .gpg files automatically, and show examples of using
          orgadb as a password book query tool.

        - Support formatters (--formatter).

        - Add options: --num-entries, --num-fields.


0.003   2022-07-03  Released-By: PERLANCAR; Urgency: medium

        - Tweak output, now output is Org document.

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

        require Org::Parser;
        my $parser = Org::Parser->new;

        for my $filename (@filenames) {
            my $doc;
            if ($filename eq '-') {
                binmode STDIN, ":encoding(utf8)";
                $doc = $parser->parse(join "", <>);
            } else {
                local $ENV{PERL_ORG_PARSER_CACHE} = $ENV{PERL_ORG_PARSER_CACHE} // 1;
                if ($filename =~ /\.gpg\z/) {
                    require IPC::System::Options;
                    my $content;
                    IPC::System::Options::system(
                        {log=>1, capture_stdout=>\$content, die=>1},
                        "gpg", "-d", $filename);
                    $doc = $parser->parse($content);
                } else {
                    $doc = $parser->parse_file($filename);
                }
            }
            push @trees, $doc;
            push @tree_filenames, $filename;
        } # for filename

        return (\@trees, \@tree_filenames);

script/orgadb-sel  view on Meta::CPAN

   + [2017-08-01] :: create
 ** twitter (perlancar)
 - username :: perlancar
 - pass :: secret2
 * persona > steven
 ** google (steven123123)
 - username :: steven123123
 - phone :: 555-123-2345
 - pass :: secret3

and you store it in C<~/passwords.gpg>. Then to query passwords:

 # What's my (perlancar)'s google password?
 % orgadb-sel -f ~/passwords.gpg /google.+perlancar/ pass -EN
 secret1

 # What's my (steven)'s phone used in the google account?
 % orgadb-sel -f ~/passwords.gpg /google.+steven/ '/phone|cell/' -EN
 555-123-2345

Or, in shell mode:

 % orgadb-sel -f ~/passwords.gpg -s
 > select /google.+perlancar/ pass -EN
 secret1
 > select /google.+steven/ '/phone|cell/' -EN
 555-123-2345
 > exit

 % _

The C<--clipboard=only> (C<-Y>) option is handy when querying password book; you
can choose to output field values only to clipboard instead of to terminal:

 # What's my (perlancar)'s google password?
 % orgadb-sel -f ~/passwords.gpg /google.+perlancar/ pass -EN -Y

=head1 DESCRIPTION

B<App::orgadb> is a set of CLIs for addressbook written in Org format. It
currently contains:

=over

=item * orgadb-sel



( run in 0.519 second using v1.01-cache-2.11-cpan-e1769b4cff6 )