]> iEval git - app-zealc.git/blob - lib/App/Zealc/Command/list.pm
Initial commit
[app-zealc.git] / lib / App / Zealc / Command / list.pm
1 package App::Zealc::Command::list;
2
3 use 5.014000;
4 use strict;
5 use warnings;
6
7 our $VERSION = '0.000_001';
8
9 use App::Zealc '-command';
10 use Term::FormatColumns qw/format_columns/;
11
12 sub opt_spec {
13 (['long|l', 'Display more information about each docset'])
14 }
15
16 sub execute {
17 my ($self, $opts, $args) = @_;
18 if ($opts->{long}) {
19 my $maxlen = 0;
20 my @args;
21 for my $set (sort {$a->name cmp $b->name} $self->app->zeal->sets) {
22 push @args, [$set->name, $set->family];
23 $maxlen = length $set->name if length $set->name > $maxlen
24 }
25 printf "%-${maxlen}s %s:\n", @$_ for @args;
26 } else {
27 my @sets = sort map {$_->name} $self->app->zeal->sets;
28 print format_columns @sets;
29 }
30 }
31
32 1;
33 __END__
34
35 =encoding utf-8
36
37 =head1 NAME
38
39 App::Zealc::Command::list - list the installed docsets
40
41 =head1 SYNOPSIS
42
43 zealc list
44 # Ansible Bootstrap 3 Perl Sass
45
46 zealc list -l
47 # Ansible ansible:
48 # Bootstrap 3 bootstrap:
49 # Perl perl:
50 # Sass sass:
51
52 =head1 DESCRIPTION
53
54 The list command displays the installed docsets. With the -l argument
55 it also displays their keywords.
56
57 =head1 SEE ALSO
58
59 L<zealc>, L<Zeal>
60
61 =head1 AUTHOR
62
63 Marius Gavrilescu, E<lt>marius@ieval.roE<gt>
64
65 =head1 COPYRIGHT AND LICENSE
66
67 Copyright (C) 2015 by Marius Gavrilescu
68
69 This library is free software; you can redistribute it and/or modify
70 it under the same terms as Perl itself, either Perl version 5.20.1 or,
71 at your option, any later version of Perl 5 you may have available.
72
73
74 =cut
This page took 0.053642 seconds and 5 git commands to generate.