line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::CSE::Command::Help; |
2
|
|
|
|
|
|
|
$App::CSE::Command::Help::VERSION = '0.016'; |
3
|
1
|
|
|
1
|
|
709
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
8
|
|
4
|
|
|
|
|
|
|
extends qw/App::CSE::Command/; |
5
|
|
|
|
|
|
|
|
6
|
1
|
|
|
1
|
|
8652
|
use Pod::Text; |
|
1
|
|
|
|
|
34648
|
|
|
1
|
|
|
|
|
88
|
|
7
|
1
|
|
|
1
|
|
642
|
use Pod::Usage; |
|
1
|
|
|
|
|
3222
|
|
|
1
|
|
|
|
|
143
|
|
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
9
|
use Log::Log4perl; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
my $LOGGER = Log::Log4perl->get_logger(); |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub execute{ |
13
|
1
|
|
|
1
|
0
|
3
|
my ($self) = @_; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
1
|
50
|
|
|
|
51
|
unless( $self->cse()->interactive() ){ |
17
|
1
|
|
|
|
|
2
|
my $output; |
18
|
1
|
|
|
|
|
11
|
my $p2txt = Pod::Text->new(); |
19
|
1
|
|
|
|
|
202
|
$p2txt->output_string(\$output); |
20
|
1
|
|
|
|
|
1188
|
$p2txt->parse_file(__FILE__); |
21
|
1
|
|
|
|
|
24633
|
$LOGGER->info("This is cse version ".$self->cse()->version()); |
22
|
1
|
|
|
|
|
492
|
$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
|
|
|
|
|
420
|
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
|
|
|
|
|
|
|
## Search for files where a given method is called: |
91
|
|
|
|
|
|
|
cse call:some_method |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head3 search syntax |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
In addition of searching for simple terms, cse supports "advanced" searches using Lucy/Lucene-like query syntax. |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
cse uses the L<Lucy> query syntax. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
For a full description of the supported query syntax, look there: |
100
|
|
|
|
|
|
|
URL<Lucy query syntax|https://metacpan.org/pod/distribution/Lucy/lib/Lucy/Search/QueryParser.pod> |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Examples: |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
# Searching 'hello' only in perl files: |
105
|
|
|
|
|
|
|
cse 'hello mime:application/x-perl' |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
# Searching ruby in everything but ruby files: |
109
|
|
|
|
|
|
|
cse -- 'ruby -mime:application/x-ruby' |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# Note the '--' that prevents the rest of the command line to be interpreted as -options. |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
=head3 search options |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=over |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=item --offset (-o) |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Offset in the result space. Defaults to 0. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=item --num (-n) |
122
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
Number of result on one page. Defaults to 5. |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=back |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 help |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Output this message. This is the default command when nothing is specified. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 check |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
Checks the health status of the index. Also output various useful things. |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 index |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
Rebuild the index from the current directory. |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head3 index options |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item --dir |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Directory to index. Defaults to current directory. |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=back |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head2 update |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
Updates the files marked as dirty (after a search) in the index. |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 watch |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Start a deamon to update the current index on changes. This will log to syslog. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
If you use the dirty files marker feature, you should disable this as it |
158
|
|
|
|
|
|
|
will keep the index in sync with your codebase. (See unwatch below). |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head2 unwatch |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Stops the deamon that watches changes to maintain the current index. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 COMMON OPTIONS |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=over |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
=item --idx |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
Specifies the index. Default to 'current directory'/.cse.idx |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
=item --verbose (-v) |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
Be more verbose. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
=back |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=head1 IGNORING FILES |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Just like you often want to ignore files managed by your CVS, you probably want cse to ignore some of your files |
182
|
|
|
|
|
|
|
at index time. |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
To have cse ignore files, create a .cseignore file in your current directory and add one pattern to ignore per line. |
185
|
|
|
|
|
|
|
Patterns should be compatible with L<Text::Glob> and are very similar to .gitignore patterns. |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
With a bit of luck, you should be able to just link .cseignore to your .gitignore and things should just work. |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 COPYRIGHT |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Copyright 2014 Jerome Eteve. |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under the terms of the Artistic License v2.0. |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
See L<http://dev.perl.org/licenses/artistic.html>. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
=cut |