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
     1.1 --- a/cline.c	Thu Feb 09 15:56:18 2012 +0100
     1.2 +++ b/cline.c	Mon Feb 13 19:10:00 2012 +0100
     1.3 @@ -34,6 +34,9 @@
     1.4      "\n  -r, -R              - includes subdirectories"
     1.5      "\n  -v, --version       - print out version information"
     1.6      "\n  -V                  - turn verbose output off, print the result only"
     1.7 +    "\n\nShortcuts:"
     1.8 +    "\n  --exclude-cstyle-comments"
     1.9 +    "\n = -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\""
    1.10      "\n\n"
    1.11      "The default call without any options is:"    
    1.12      "\n  cline ./\n\n"
    1.13 @@ -46,8 +49,8 @@
    1.14      "\ncounted when it does not start or end with the respective patterns."
    1.15      "\nPlease note, that cline does not remove whitespace characters as this"
    1.16      "\nmight not be reasonable in some cases."
    1.17 -    "\n\nExample (C comments):"
    1.18 -    "\n  cline -s .c,.h -E \"\\s*//\" -e \"\\s*/\\*\" \"\\*/\\s*\"";
    1.19 +    "\n\nExample (C without comments):"
    1.20 +    "\n  cline -s .c,.h --exclude-cstyle-comments";
    1.21      
    1.22    printf(helpText);
    1.23  }
    1.24 @@ -173,9 +176,17 @@
    1.25        add_string(settings->regex->pattern_list, argv[t]);
    1.26        add_string(settings->regex->pattern_list, "$");
    1.27      }
    1.28 -    /* Path */
    1.29      if (argflags == 0) {
    1.30 -      if (registerArgument(&checked, 1024)) {
    1.31 +      /* SHORTCUTS */
    1.32 +      /* exclude-cstyle-comments */
    1.33 +      if (strcmp(argv[t], "--exclude-cstyle-comments") == 0) {
    1.34 +        add_string(settings->regex->pattern_list, "\\s*//");
    1.35 +        add_string(settings->regex->pattern_list, "$");
    1.36 +        add_string(settings->regex->pattern_list, "\\s*/\\*");
    1.37 +        add_string(settings->regex->pattern_list, "\\*/\\s*");
    1.38 +      }
    1.39 +      /* Path */
    1.40 +      else if (registerArgument(&checked, 1024)) {
    1.41          return exit_with_help(settings, 1);
    1.42        }
    1.43        directory = argv[t];

mercurial