added --exclude-cstyle-comments shortcut

Mon, 13 Feb 2012 19:10:00 +0100

author
Mike Becker <universe@uap-core.de>
date
Mon, 13 Feb 2012 19:10:00 +0100
changeset 31
27c3c1c6b768
parent 30
d642fdb6745e
child 32
51d6e45a7592

added --exclude-cstyle-comments shortcut

cline.c file | annotate | diff | comparison | revisions
--- a/cline.c	Thu Feb 09 15:56:18 2012 +0100
+++ b/cline.c	Mon Feb 13 19:10:00 2012 +0100
@@ -34,6 +34,9 @@
     "\n  -r, -R              - includes subdirectories"
     "\n  -v, --version       - print out version information"
     "\n  -V                  - turn verbose output off, print the result only"
+    "\n\nShortcuts:"
+    "\n  --exclude-cstyle-comments"
+    "\n = -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\""
     "\n\n"
     "The default call without any options is:"    
     "\n  cline ./\n\n"
@@ -46,8 +49,8 @@
     "\ncounted when it does not start or end with the respective patterns."
     "\nPlease note, that cline does not remove whitespace characters as this"
     "\nmight not be reasonable in some cases."
-    "\n\nExample (C comments):"
-    "\n  cline -s .c,.h -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\"";
+    "\n\nExample (C without comments):"
+    "\n  cline -s .c,.h --exclude-cstyle-comments";
     
   printf(helpText);
 }
@@ -173,9 +176,17 @@
       add_string(settings->regex->pattern_list, argv[t]);
       add_string(settings->regex->pattern_list, "$");
     }
-    /* Path */
     if (argflags == 0) {
-      if (registerArgument(&checked, 1024)) {
+      /* SHORTCUTS */
+      /* exclude-cstyle-comments */
+      if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {
+        add_string(settings->regex->pattern_list, "\\s*//");
+        add_string(settings->regex->pattern_list, "$");
+        add_string(settings->regex->pattern_list, "\\s*/\\*");
+        add_string(settings->regex->pattern_list, "\\*/\\s*");
+      }
+      /* Path */
+      else if (registerArgument(&checked, 1024)) {
         return exit_with_help(settings, 1);
       }
       directory = argv[t];

mercurial