001package org.unix4j.unix.grep; 002 003import org.unix4j.unix.Grep; 004 005/** 006 * Options for the {@link Grep grep} command with the 007 * the following options: 008 * <p> 009 * <table> 010 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -i}</td><td> </td><td nowrap="nowrap">{@code --ignoreCase}</td><td> </td><td>Match lines ignoring the case when comparing the strings, also known 011 from Unix with its acronym 'i'.</td></tr> 012 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -v}</td><td> </td><td nowrap="nowrap">{@code --invertMatch}</td><td> </td><td>Invert the match result, that is, a non-matching line is written to 013 the output and a matching line is not. This option is also known 014 from Unix with its acronym 'v'.</td></tr> 015 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -F}</td><td> </td><td nowrap="nowrap">{@code --fixedStrings}</td><td> </td><td>Use fixed-strings matching instead of regular expressions. This is 016 usually faster than the standard regexp version. 017 <p> 018 (This option is ignored if a {@code pattern} operand is specified 019 instead of the {@code regexp} string).</td></tr> 020 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -n}</td><td> </td><td nowrap="nowrap">{@code --lineNumber}</td><td> </td><td>Prefix each line of output with the line number within its input 021 file.</td></tr> 022 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -c}</td><td> </td><td nowrap="nowrap">{@code --count}</td><td> </td><td>Suppress normal output; instead print a count of matching lines for 023 each input file. With the {@code -v}, {@code --invertMatch} option, 024 count non-matching lines.</td></tr> 025 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -l}</td><td> </td><td nowrap="nowrap">{@code --matchingFiles}</td><td> </td><td>Suppress normal output; instead print the name of each input file 026 from which output would normally have been printed. The scanning 027 will stop on the first match.</td></tr> 028 * <tr valign="top"><td width="10px"></td><td nowrap="nowrap">{@code -x}</td><td> </td><td nowrap="nowrap">{@code --wholeLine}</td><td> </td><td>Select only those matches that exactly match the whole line 029 excluding the terminating line ending. 030 <p> 031 (This option is ignored if a {@code pattern} operand is specified 032 instead of the {@code regexp} string).</td></tr> 033 * </table> 034 * <p> 035 * This class serves as entry point to every possible set of {@code grep} options 036 * defined as an enum constant. With this explicit expansion of all possible 037 * option combinations, options can be passed to the command in a very compact 038 * form, such as: 039 * <pre> 040 * grep(Grep.Options.i, ...); 041 * grep(Grep.Options.i.v, ...); 042 * ... 043 * grep(Grep.Options.i.v.F.n.c.l.x, ...); 044 * </pre> 045 */ 046public final class GrepOptionSets { 047 /** 048 * The singleton instance. 049 */ 050 public static final GrepOptionSets INSTANCE = new GrepOptionSets(); 051 052 /** 053 * Option {@code "-c"}: Suppress normal output; instead print a count of matching lines for 054 each input file. With the {@code -v}, {@code --invertMatch} option, 055 count non-matching lines. 056 * <p> 057 * The option {@code "-c"} is equivalent to the {@code "--}{@link #count count}{@code "} option. 058 */ 059 public final GrepOptionSet_Fcilnvx c = GrepOptionSet_Fcilnvx.Active_c; 060 /** 061 * Option {@code "--count"}: Suppress normal output; instead print a count of matching lines for 062 each input file. With the {@code -v}, {@code --invertMatch} option, 063 count non-matching lines. 064 * <p> 065 * The option {@code "--count"} is equivalent to the {@code "-}{@link #c c}{@code "} option. 066 */ 067 public final GrepOptionSet_Fcilnvx count = GrepOptionSet_Fcilnvx.Active_c_long; 068 /** 069 * Option {@code "-F"}: Use fixed-strings matching instead of regular expressions. This is 070 usually faster than the standard regexp version. 071 <p> 072 (This option is ignored if a {@code pattern} operand is specified 073 instead of the {@code regexp} string). 074 * <p> 075 * The option {@code "-F"} is equivalent to the {@code "--}{@link #fixedStrings fixedStrings}{@code "} option. 076 */ 077 public final GrepOptionSet_Fcilnvx F = GrepOptionSet_Fcilnvx.Active_F; 078 /** 079 * Option {@code "--fixedStrings"}: Use fixed-strings matching instead of regular expressions. This is 080 usually faster than the standard regexp version. 081 <p> 082 (This option is ignored if a {@code pattern} operand is specified 083 instead of the {@code regexp} string). 084 * <p> 085 * The option {@code "--fixedStrings"} is equivalent to the {@code "-}{@link #F F}{@code "} option. 086 */ 087 public final GrepOptionSet_Fcilnvx fixedStrings = GrepOptionSet_Fcilnvx.Active_F_long; 088 /** 089 * Option {@code "-i"}: Match lines ignoring the case when comparing the strings, also known 090 from Unix with its acronym 'i'. 091 * <p> 092 * The option {@code "-i"} is equivalent to the {@code "--}{@link #ignoreCase ignoreCase}{@code "} option. 093 */ 094 public final GrepOptionSet_Fcilnvx i = GrepOptionSet_Fcilnvx.Active_i; 095 /** 096 * Option {@code "--ignoreCase"}: Match lines ignoring the case when comparing the strings, also known 097 from Unix with its acronym 'i'. 098 * <p> 099 * The option {@code "--ignoreCase"} is equivalent to the {@code "-}{@link #i i}{@code "} option. 100 */ 101 public final GrepOptionSet_Fcilnvx ignoreCase = GrepOptionSet_Fcilnvx.Active_i_long; 102 /** 103 * Option {@code "-v"}: Invert the match result, that is, a non-matching line is written to 104 the output and a matching line is not. This option is also known 105 from Unix with its acronym 'v'. 106 * <p> 107 * The option {@code "-v"} is equivalent to the {@code "--}{@link #invertMatch invertMatch}{@code "} option. 108 */ 109 public final GrepOptionSet_Fcilnvx v = GrepOptionSet_Fcilnvx.Active_v; 110 /** 111 * Option {@code "--invertMatch"}: Invert the match result, that is, a non-matching line is written to 112 the output and a matching line is not. This option is also known 113 from Unix with its acronym 'v'. 114 * <p> 115 * The option {@code "--invertMatch"} is equivalent to the {@code "-}{@link #v v}{@code "} option. 116 */ 117 public final GrepOptionSet_Fcilnvx invertMatch = GrepOptionSet_Fcilnvx.Active_v_long; 118 /** 119 * Option {@code "-n"}: Prefix each line of output with the line number within its input 120 file. 121 * <p> 122 * The option {@code "-n"} is equivalent to the {@code "--}{@link #lineNumber lineNumber}{@code "} option. 123 */ 124 public final GrepOptionSet_Fcilnvx n = GrepOptionSet_Fcilnvx.Active_n; 125 /** 126 * Option {@code "--lineNumber"}: Prefix each line of output with the line number within its input 127 file. 128 * <p> 129 * The option {@code "--lineNumber"} is equivalent to the {@code "-}{@link #n n}{@code "} option. 130 */ 131 public final GrepOptionSet_Fcilnvx lineNumber = GrepOptionSet_Fcilnvx.Active_n_long; 132 /** 133 * Option {@code "-l"}: Suppress normal output; instead print the name of each input file 134 from which output would normally have been printed. The scanning 135 will stop on the first match. 136 * <p> 137 * The option {@code "-l"} is equivalent to the {@code "--}{@link #matchingFiles matchingFiles}{@code "} option. 138 */ 139 public final GrepOptionSet_Fcilnvx l = GrepOptionSet_Fcilnvx.Active_l; 140 /** 141 * Option {@code "--matchingFiles"}: Suppress normal output; instead print the name of each input file 142 from which output would normally have been printed. The scanning 143 will stop on the first match. 144 * <p> 145 * The option {@code "--matchingFiles"} is equivalent to the {@code "-}{@link #l l}{@code "} option. 146 */ 147 public final GrepOptionSet_Fcilnvx matchingFiles = GrepOptionSet_Fcilnvx.Active_l_long; 148 /** 149 * Option {@code "-x"}: Select only those matches that exactly match the whole line 150 excluding the terminating line ending. 151 <p> 152 (This option is ignored if a {@code pattern} operand is specified 153 instead of the {@code regexp} string). 154 * <p> 155 * The option {@code "-x"} is equivalent to the {@code "--}{@link #wholeLine wholeLine}{@code "} option. 156 */ 157 public final GrepOptionSet_Fcilnvx x = GrepOptionSet_Fcilnvx.Active_x; 158 /** 159 * Option {@code "--wholeLine"}: Select only those matches that exactly match the whole line 160 excluding the terminating line ending. 161 <p> 162 (This option is ignored if a {@code pattern} operand is specified 163 instead of the {@code regexp} string). 164 * <p> 165 * The option {@code "--wholeLine"} is equivalent to the {@code "-}{@link #x x}{@code "} option. 166 */ 167 public final GrepOptionSet_Fcilnvx wholeLine = GrepOptionSet_Fcilnvx.Active_x_long; 168 169}