6 use AUR
::Query
qw(query query_multi);
7 use AUR
::Options
qw(add_from_stdin);
17 't|type=s' => \
$opt_type,
19 'r|raw' => sub { } # noop
22 if (not length($opt_type)) {
23 say STDERR
"$argv0: type must be specified";
27 if (not scalar(@ARGV)) {
28 say STDERR
"$argv0: at least one argument required";
31 # Handle '-' to take packages from stdin
32 add_from_stdin
(\
@ARGV, ['-', '/dev/stdin']);
34 # Exit gracefully on empty stdin, e.g. when piping from `aur repo -u`
35 if (not scalar(@ARGV)) {
38 my %query_args = (type
=> $opt_type, by
=> $opt_by, callback
=> sub { say @_ });
40 # search requests take a single argument only
41 if ($opt_type eq "search" or $opt_type eq "suggest" or $opt_type eq "suggest-pkgbase") {
42 map { query
(term
=> $_, %query_args) } @ARGV;
44 query_multi
(terms
=> \
@ARGV, %query_args);
48 # vim: set et sw=4 sts=4 ft=perl: