Initial commit
[app-zealc.git] / lib / App / Zealc / Command / expand.pm
CommitLineData
6c01e3e3
MG
1package App::Zealc::Command::expand;
2
3use 5.014000;
4use strict;
5use warnings;
6
7our $VERSION = '0.000_001';
8
9use App::Zealc '-command';
10
11sub usage_desc { "%c expand %o pattern"}
12
13sub opt_spec {
14 (['family|f!', 'Include docset family in output']),
15}
16
17sub validate_args {
18 my ($self, $opts, $args) = @_;
19 my @args = @$args;
20 $self->usage_error("No pattern specified") unless @args;
21 $self->usage_error("Too many arguments") if @args > 1;
22}
23
24sub execute {
25 my ($self, $opts, $args) = @_;
26 my @results = sort { $a->name cmp $b->name } $self->app->zeal->query($args->[0]);
27 exit 1 unless @results;
28 say join "\n", map {
29 my $family = $_->docset->family;
30 $opts->{family} ? "$family:" . $_->name : $_->name
31 } @results
32}
33
341;
35__END__
36
37=encoding utf-8
38
39=head1 NAME
40
41App::Zealc::Command::expand - list all documents that match a pattern
42
43=head1 SYNOPSIS
44
45 zealc expand perlmo%
46 # perlmod
47 # perlmodinstall
48 # perlmodlib
49 # perlmodstyle
50
51 zealc expand -f perl_os
52 # perl:perldos
53 # perl:perlvos
54
55=head1 DESCRIPTION
56
57The expand command lists all documents that match a case-insensitive
58SQL LIKE pattern.
59
60A SQL LIKE pattern is similar to a shell glob. The "%" character
61matches zero or more characters (like "*" in a shell glob or ".*" in a
62regex) and "_" matches exactly one character (like "?" in a shell glob
63or "." in a regex). Matching is case-insensitive.
64
65=head1 SEE ALSO
66
67L<zealc>, L<Zeal>
68
69=head1 AUTHOR
70
71Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
72
73=head1 COPYRIGHT AND LICENSE
74
75Copyright (C) 2015 by Marius Gavrilescu
76
77This library is free software; you can redistribute it and/or modify
78it under the same terms as Perl itself, either Perl version 5.20.1 or,
79at your option, any later version of Perl 5 you may have available.
80
81
82=cut
This page took 0.01331 seconds and 4 git commands to generate.