line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::CSE::Command::Help; |
2
|
|
|
|
|
|
|
$App::CSE::Command::Help::VERSION = '0.015'; |
3
|
1
|
|
|
1
|
|
700
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
extends qw/App::CSE::Command/; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
8068
|
use Pod::Text; |
|
1
|
|
|
|
|
33889
|
|
|
1
|
|
|
|
|
83
|
|
7
|
1
|
|
|
1
|
|
589
|
use Pod::Usage; |
|
1
|
|
|
|
|
3220
|
|
|
1
|
|
|
|
|
124
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
8
|
use Log::Log4perl; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
10
|
|
|
|
|
|
|
my $LOGGER = Log::Log4perl->get_logger(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub execute{ |
13
|
1
|
|
|
1
|
0
|
4
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
|
|
|
32
|
unless( $self->cse()->interactive() ){ |
17
|
1
|
|
|
|
|
3
|
my $output; |
18
|
1
|
|
|
|
|
8
|
my $p2txt = Pod::Text->new(); |
19
|
1
|
|
|
|
|
201
|
$p2txt->output_string(\$output); |
20
|
1
|
|
|
|
|
1091
|
$p2txt->parse_file(__FILE__); |
21
|
1
|
|
|
|
|
24366
|
$LOGGER->info("This is cse version ".$self->cse()->version()); |
22
|
1
|
|
|
|
|
538
|
$LOGGER->info($output); |
23
|
|
|
|
|
|
|
}else{ |
24
|
0
|
|
|
|
|
0
|
Pod::Usage::pod2usage( -input => __FILE__ , -verbose => 2, |
25
|
|
|
|
|
|
|
-message => 'This is cse version '.$self->cse()->version() |
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
} |
28
|
1
|
|
|
|
|
455
|
return 1; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
__END__ |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 NAME |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
App::CSE::Command::Help - cse's help |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head1 SYNOPSIS |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
cse <command> [ .. options .. ] [ -- ] [ command arguments ] |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
# Search for 'Something' |
44
|
|
|
|
|
|
|
cse Something |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
# Search for 'search' |
47
|
|
|
|
|
|
|
cse search search |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
# Check the index. |
50
|
|
|
|
|
|
|
cse check |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 COMMANDS |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 search |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Searches the index for matches. Requires a query string. The name of the command is optional if you |
57
|
|
|
|
|
|
|
are searching for a term that doesnt match a command. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Optionally, you can give a directory to retrict the search to a specific directory. |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
Examples: |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
## Searching for the word 'Something' |
64
|
|
|
|
|
|
|
cse Something |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
## Hello without world |
67
|
|
|
|
|
|
|
cse hello AND NOT world |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
## Same thing, but more 'Lucy-ish': |
70
|
|
|
|
|
|
|
cse hello -world |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
## Searching for the word 'search' |
73
|
|
|
|
|
|
|
cse search search |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
## Searching for the word 'Something' only in the directory './lib' |
76
|
|
|
|
|
|
|
cse search Something ./lib |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
## Searching for any term starting with 'some': |
79
|
|
|
|
|
|
|
cse search some* |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
## Search for some_method |
82
|
|
|
|
|
|
|
cse some_method |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
## Search for some_method declarations only: |
85
|
|
|
|
|
|
|
cse decl:some_method |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
## Search for some_method, excluding the files declaring it: |
88
|
|
|
|
|
|
|
cse some_method -decl:some_method |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=head3 search syntax |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
In addition of searching for simple terms, cse supports "advanced" searches using Lucy/Lucene-like query syntax. |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
cse uses the L<Lucy> query syntax. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
For a full description of the supported query syntax, look there: |
97
|
|
|
|
|
|
|
URL<Lucy query syntax|https://metacpan.org/pod/distribution/Lucy/lib/Lucy/Search/QueryParser.pod> |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
Examples: |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
# Searching 'hello' only in perl files: |
102
|
|
|
|
|
|
|
cse 'hello mime:application/x-perl' |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
# Searching ruby in everything but ruby files: |
106
|
|
|
|
|
|
|
cse -- 'ruby -mime:application/x-ruby' |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Note the '--' that prevents the rest of the command line to be interpreted as -options. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head3 search options |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=over |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=item --offset (-o) |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Offset in the result space. Defaults to 0. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=item --num (-n) |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
Number of result on one page. Defaults to 5. |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
=back |
123
|
|
|
|
|
|
|
|
124
|
|
|
|
|
|
|
=head2 help |
125
|
|
|
|
|
|
|
|
126
|
|
|
|
|
|
|
Output this message. This is the default command when nothing is specified. |
127
|
|
|
|
|
|
|
|
128
|
|
|
|
|
|
|
=head2 check |
129
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
Checks the health status of the index. Also output various useful things. |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=head2 index |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Rebuild the index from the current directory. |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
=head3 index options |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=over |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=item --dir |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Directory to index. Defaults to current directory. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=back |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=head2 update |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
Updates the files marked as dirty (after a search) in the index. |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
=head2 watch |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
Start a deamon to update the current index on changes. This will log to syslog. |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
If you use the dirty files marker feature, you should disable this as it |
155
|
|
|
|
|
|
|
will keep the index in sync with your codebase. (See unwatch below). |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=head2 unwatch |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Stops the deamon that watches changes to maintain the current index. |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=head1 COMMON OPTIONS |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
=over |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item --idx |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Specifies the index. Default to 'current directory'/.cse.idx |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item --verbose (-v) |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Be more verbose. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=back |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=head1 IGNORING FILES |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
Just like you often want to ignore files managed by your CVS, you probably want cse to ignore some of your files |
179
|
|
|
|
|
|
|
at index time. |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
To have cse ignore files, create a .cseignore file in your current directory and add one pattern to ignore per line. |
182
|
|
|
|
|
|
|
Patterns should be compatible with L<Text::Glob> and are very similar to .gitignore patterns. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
With a bit of luck, you should be able to just link .cseignore to your .gitignore and things should just work. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
=head1 COPYRIGHT |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
Copyright 2014 Jerome Eteve. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
See L<http://dev.perl.org/licenses/artistic.html>. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |