2 * Copyright (C) 2010, Dominique van de Vorle <dvdvorle@gmail.com>
6 * Redistribution and use in source and binary forms, with or
7 * without modification, are permitted provided that the following
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
13 * - Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * - Neither the name of the Git Development Community nor the
19 * names of its contributors may be used to endorse or promote
20 * products derived from this software without specific prior
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
24 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
25 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
26 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
29 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
30 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
33 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
35 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
39 using System
.Collections
.Generic
;
44 namespace GitSharp
.Commands
46 public class GrepCommand
50 public GrepCommand() {
53 // note: the naming of command parameters is not following .NET conventions in favour of git command line parameter naming conventions.
55 #region Properties / Options
56 public List
<string> Arguments { get; set; }
60 /// Instead of searching in the working tree files, check
61 /// the blobs registered in the index file.
64 public bool Cached { get; set; }
69 /// Process binary files as if they were text.
72 public bool Text { get; set; }
77 /// Ignore case differences between the patterns and the
81 public bool IgnoreCase { get; set; }
86 /// Don't match the pattern in binary files.
89 public bool I { get; set; }
94 /// For each pathspec given on command line, descend at most <depth>
95 /// levels of directories. A negative value means no limit.
98 public string MaxDepth { get; set; }
103 /// Match the pattern only at word boundary (either begin at the
104 /// beginning of a line, or preceded by a non-word character; end at
105 /// the end of a line or followed by a non-word character).
108 public bool WordRegexp { get; set; }
113 /// Select non-matching lines.
116 public bool InvertMatch { get; set; }
121 /// By default, the command shows the filename for each
122 /// match. `-h` option is used to suppress this output.
123 /// `-H` is there for completeness and does not do anything
124 /// except it overrides `-h` given earlier on the command
128 public bool H { get; set; }
133 /// When run from a subdirectory, the command usually
134 /// outputs paths relative to the current directory. This
135 /// option forces paths to be output relative to the project
139 public bool FullName { get; set; }
144 /// Use POSIX extended/basic regexp for patterns. Default
145 /// is to use basic regexp.
148 public bool ExtendedRegexp { get; set; }
153 /// Use POSIX extended/basic regexp for patterns. Default
154 /// is to use basic regexp.
157 public bool BasicRegexp { get; set; }
162 /// Use fixed strings for patterns (don't interpret pattern
166 public bool FixedStrings { get; set; }
171 /// Prefix the line number to matching lines.
174 public bool N { get; set; }
179 /// Instead of showing every matched line, show only the
180 /// names of files that contain (or do not contain) matches.
181 /// For better compatibility with 'git-diff', --name-only is a
182 /// synonym for --files-with-matches.
185 public bool FilesWithMatches { get; set; }
190 /// Instead of showing every matched line, show only the
191 /// names of files that contain (or do not contain) matches.
192 /// For better compatibility with 'git-diff', --name-only is a
193 /// synonym for --files-with-matches.
196 public bool NameOnly { get; set; }
201 /// Instead of showing every matched line, show only the
202 /// names of files that contain (or do not contain) matches.
203 /// For better compatibility with 'git-diff', --name-only is a
204 /// synonym for --files-with-matches.
207 public bool FilesWithoutMatch { get; set; }
212 /// Output \0 instead of the character that normally follows a
216 public bool Null { get; set; }
221 /// Instead of showing every matched line, show the number of
222 /// lines that match.
225 public bool Count { get; set; }
230 /// Show colored matches.
233 public bool Color { get; set; }
238 /// Turn off match highlighting, even when the configuration file
239 /// gives the default to color output.
242 public bool NoColor { get; set; }
247 /// Show `context` trailing (`A` -- after), or leading (`B`
248 /// -- before), or both (`C` -- context) lines, and place a
249 /// line containing `--` between contiguous groups of
253 public string A { get; set; }
258 /// Show `context` trailing (`A` -- after), or leading (`B`
259 /// -- before), or both (`C` -- context) lines, and place a
260 /// line containing `--` between contiguous groups of
264 public string B { get; set; }
269 /// Show `context` trailing (`A` -- after), or leading (`B`
270 /// -- before), or both (`C` -- context) lines, and place a
271 /// line containing `--` between contiguous groups of
275 public string C { get; set; }
280 /// Show the preceding line that contains the function name of
281 /// the match, unless the matching line is a function name itself.
282 /// The name is determined in the same way as 'git diff' works out
283 /// patch hunk headers (see 'Defining a custom hunk-header' in
284 /// linkgit:gitattributes[5]).
287 public bool ShowFunction { get; set; }
292 /// Read patterns from <file>, one per line.
295 public string F { get; set; }
300 /// The next parameter is the pattern. This option has to be
301 /// used for patterns starting with - and should be used in
302 /// scripts passing user input to grep. Multiple patterns are
303 /// combined by 'or'.
306 public bool E { get; set; }
312 /// Specify how multiple patterns are combined using Boolean
313 /// expressions. `--or` is the default operator. `--and` has
314 /// higher precedence than `--or`. `-e` has to be used for all
318 public bool And { get; set; }
324 /// Specify how multiple patterns are combined using Boolean
325 /// expressions. `--or` is the default operator. `--and` has
326 /// higher precedence than `--or`. `-e` has to be used for all
330 public bool Or { get; set; }
336 /// Specify how multiple patterns are combined using Boolean
337 /// expressions. `--or` is the default operator. `--and` has
338 /// higher precedence than `--or`. `-e` has to be used for all
342 public bool Not { get; set; }
347 /// When giving multiple pattern expressions combined with `--or`,
348 /// this flag is specified to limit the match to files that
349 /// have lines to match all of them.
352 public bool AllMatch { get; set; }
356 public override void Execute()
358 throw new NotImplementedException();