cline.c

changeset 31
27c3c1c6b768
parent 30
d642fdb6745e
child 32
51d6e45a7592
equal deleted inserted replaced
30:d642fdb6745e 31:27c3c1c6b768
32 "\n -S <suffixes> - count any file except those with these suffixes" 32 "\n -S <suffixes> - count any file except those with these suffixes"
33 "\n (separated by commas)" 33 "\n (separated by commas)"
34 "\n -r, -R - includes subdirectories" 34 "\n -r, -R - includes subdirectories"
35 "\n -v, --version - print out version information" 35 "\n -v, --version - print out version information"
36 "\n -V - turn verbose output off, print the result only" 36 "\n -V - turn verbose output off, print the result only"
37 "\n\nShortcuts:"
38 "\n --exclude-cstyle-comments"
39 "\n = -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\""
37 "\n\n" 40 "\n\n"
38 "The default call without any options is:" 41 "The default call without any options is:"
39 "\n cline ./\n\n" 42 "\n cline ./\n\n"
40 "So each file in the working directory is counted. If you want to count C" 43 "So each file in the working directory is counted. If you want to count C"
41 "\nsource code in your working directory and its subdirectories, type:" 44 "\nsource code in your working directory and its subdirectories, type:"
44 "\nAfter a line matches the regex pattern <start> any following line is" 47 "\nAfter a line matches the regex pattern <start> any following line is"
45 "\nnot counted unless a line matches the <end> pattern. A line is still " 48 "\nnot counted unless a line matches the <end> pattern. A line is still "
46 "\ncounted when it does not start or end with the respective patterns." 49 "\ncounted when it does not start or end with the respective patterns."
47 "\nPlease note, that cline does not remove whitespace characters as this" 50 "\nPlease note, that cline does not remove whitespace characters as this"
48 "\nmight not be reasonable in some cases." 51 "\nmight not be reasonable in some cases."
49 "\n\nExample (C comments):" 52 "\n\nExample (C without comments):"
50 "\n cline -s .c,.h -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\""; 53 "\n cline -s .c,.h --exclude-cstyle-comments";
51 54
52 printf(helpText); 55 printf(helpText);
53 } 56 }
54 57
55 int exit_with_version(settings_t* settings) { 58 int exit_with_version(settings_t* settings) {
171 return exit_with_help(settings, 1); 174 return exit_with_help(settings, 1);
172 } 175 }
173 add_string(settings->regex->pattern_list, argv[t]); 176 add_string(settings->regex->pattern_list, argv[t]);
174 add_string(settings->regex->pattern_list, "$"); 177 add_string(settings->regex->pattern_list, "$");
175 } 178 }
176 /* Path */
177 if (argflags == 0) { 179 if (argflags == 0) {
178 if (registerArgument(&checked, 1024)) { 180 /* SHORTCUTS */
181 /* exclude-cstyle-comments */
182 if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {
183 add_string(settings->regex->pattern_list, "\\s*//");
184 add_string(settings->regex->pattern_list, "$");
185 add_string(settings->regex->pattern_list, "\\s*/\\*");
186 add_string(settings->regex->pattern_list, "\\*/\\s*");
187 }
188 /* Path */
189 else if (registerArgument(&checked, 1024)) {
179 return exit_with_help(settings, 1); 190 return exit_with_help(settings, 1);
180 } 191 }
181 directory = argv[t]; 192 directory = argv[t];
182 } 193 }
183 } 194 }

mercurial