src/cline.c

changeset 90
9b541d22d649
parent 89
c80878da618c
equal deleted inserted replaced
89:c80878da618c 90:9b541d22d649
43 "\n\nOptions:" 43 "\n\nOptions:"
44 "\n -b <level> - Binary file heuristics level (default medium)" 44 "\n -b <level> - Binary file heuristics level (default medium)"
45 "\n One of: ignore low medium high" 45 "\n One of: ignore low medium high"
46 "\n -c - Count non-whitespace characters instead of lines" 46 "\n -c - Count non-whitespace characters instead of lines"
47 "\n -d - Report only directory sums" 47 "\n -d - Report only directory sums"
48 "\n -D <path> - Excludes the directory at the specified <path>"
49 "\n -D <name> - Excludes all directories with the given <name>"
48 "\n -E <pattern> - Excludes any line matching the <pattern>" 50 "\n -E <pattern> - Excludes any line matching the <pattern>"
49 "\n -e <start> <end> - Excludes lines between <start> and <end>" 51 "\n -e <start> <end> - Excludes lines between <start> and <end>"
50 "\n You may use these options multiple times" 52 "\n You may use these options multiple times"
51 "\n -h, --help - This help text" 53 "\n -h, --help - This help text"
52 "\n -i - Print out individual sums per file extension" 54 "\n -i - Print out individual sums per file extension"
114 char* excludeSuffix = NULL; 116 char* excludeSuffix = NULL;
115 int checked = 0; 117 int checked = 0;
116 118
117 for (int t = 1 ; t < argc ; t++) { 119 for (int t = 1 ; t < argc ; t++) {
118 120
119 int argflags = checkArgument(argv[t], "hsSrRmvVbeEicd"); 121 int argflags = checkArgument(argv[t], "hsSrRmvVbeEicdD");
120 int paropt = 0; 122 int paropt = 0;
121 123
122 /* h */ 124 /* h */
123 if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) { 125 if ((argflags & 1) > 0 || strcmp(argv[t], "--help") == 0) {
124 return exit_with_help(settings, 0); 126 return exit_with_help(settings, 0);
231 } 233 }
232 /* ignored together with -V */ 234 /* ignored together with -V */
233 if ((checked & 128) == 0) { 235 if ((checked & 128) == 0) {
234 settings->dirsOnly = true; 236 settings->dirsOnly = true;
235 } 237 }
238 }
239 /* D */
240 if ((argflags & 16384) > 0) {
241 t++;
242 if (!checkParamOpt(&paropt) || t >= argc) {
243 return exit_with_help(settings, 1);
244 }
245 // TODO: normalize argument before adding to dir list
246 // this makes it more efficient to compare dir names later
247 add_string(settings->excludeDirs, argv[t]);
236 } 248 }
237 if (argflags == 0) { 249 if (argflags == 0) {
238 /* SHORTCUTS */ 250 /* SHORTCUTS */
239 if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) { 251 if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {
240 add_string(settings->regex->pattern_list, "\\s*//"); 252 add_string(settings->regex->pattern_list, "\\s*//");

mercurial