packages feed

cgrep 6.5.15 → 6.6

raw patch · 5 files changed

+92/−73 lines, 5 files

Files

README.md view
@@ -4,79 +4,91 @@ Usage ----- -Cgrep 6.5.15 Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.6. Usage: cgrep [OPTION] [PATTERN] files...  cgrep [OPTIONS] [ITEM] + Pattern: -    -f --file=FILE            Read PATTERNs from file (one per line)-    -w --word                 Force word matching-    -p --prefix               Force prefix matching-    -s --suffix               Force suffix matching-    -e --edit                 Use edit distance-    -G --regex                Use regex matching (posix)-    -P --regex-pcre           Use regex matching (pcre)-    -i --ignore-case          Ignore case distinctions+    -f --file=FILE             Read PATTERNs from file (one per line)+    -w --word                  Force word matching+    -p --prefix                Force prefix matching+    -s --suffix                Force suffix matching+    -e --edit                  Use edit distance+    -G --regex                 Use regex matching (posix)+    -P --regex-pcre            Use regex matching (pcre)+    -i --ignore-case           Ignore case distinctions + Context filters (generic):+    +    -c --code                  Enable search in source code+    -m --comment               Enable search in comments+    -l --literal               Enable search in string literals -    -c --code                 enable search in source code-    -m --comment              enable search in comments-    -l --literal              enable search in string literals  Semantic (generic): -    -S --semantic             "code" pattern: _, _1, _2... (identifiers), $,-                              $1, $2... (optionals), ANY, KEY, STR, CHR, NUM,-                              HEX, OCT, OR. -> e.g. "_1(_1 && \$)" search for-                              move constructors, "struct OR class _ { OR : OR <"-                              search for a class declaration+    -S --semantic              "code" pattern: _, _1, _2... (identifiers), $,+                               $1, $2... (optionals), ANY, KEY, STR, CHR, LIT,+                               NUM, HEX, OCT, OR. -> e.g. "_1(_1 && \$)" search+                               for move constructors, "struct OR class _ { OR :+                               OR <" search for a class declaration + C/C++ language: -       --identifier           identifiers-       --keyword              keywords-       --directive            preprocessing directives-       --header               headers names-       --number               literal numbers-       --string               literal strings-       --char                 literal chars-       --oper                 operators- +      --identifier            Identifiers+      --keyword               Keywords+      --directive             Preprocessing directives+      --header                Headers names+      --number                Literal numbers+      --string                Literal strings+      --char                  Literal chars+      --oper                  Operators++ Output control:- -    -h --no-filename          Suppress the file name prefix on output-    -N --no-linenumber        Suppress the line number on output lines-       --language-filter=ITEM Specify languages. ie: Cpp, +Haskell, -Makefile-       --language-force=ITEM  Force the language-       --language-map         Lists the language mappings-       --magic-filter=ITEM    Use unix magic as file-filter-       --multiline=INT        Enable multi-line matching-    -r --recursive            Enable recursive search (don't follow symlinks)-       --prune-dir=ITEM       Do not descend into dir-    -R --deference-recursive  Recursive, follow symlinks-    -v --invert-match         select non-matching lines-       --max-count=INT        stop search in files after INT matches-       --count                print only a count of matching lines per file-       --show-match           show list of matching tokens-       --color                use colors to highlight the matching strings-       --format=STRING        format output. Var: #f #n #l #t ## #, #; #0 #1...-                              e.g. "#f:#n #0 #1"-       --json                 format output as json object-       --xml                  format output as xml document-  ++       --max-count=INT         Stop search in files after INT matches+       --language-filter=ITEM  Specify languages. ie: Cpp, +Haskell, -Makefile+       --language-force=ITEM   Force the language+       --language-map          Lists the language mappings+       --magic-filter=ITEM     Use unix magic as file-filter+    -v --invert-match          Select non-matching lines+       --multiline=INT         Enable multi-line matching+    -r --recursive             Enable recursive search (don't follow symlinks)+       --prune-dir=ITEM        Do not descend into dir+    -R --deference-recursive   Recursive, follow symlinks+++Output format:++       --color                 Use colors to highlight the matching strings+       --show-match            Show list of matching tokens+    -h --no-filename           Suppress the file name prefix on output+    -N --no-linenumber         Suppress the line number on output lines+       --count                 Print only a count of matching lines per file+       --filename-only         Print only the name of files containing matches+       --format=STRING         Format output. Var: #f #n #l #t ## #, #; #0+                               #1... e.g. "#f:#n #0 #1"+       --json                  Format output as json object+       --xml                   Format output as xml document++ Concurrency: -    -j --jobs=INT             Number of jobs-       --cores=INT            Number of physical processors utilized-       --chunk=INT            Specify the length of chunks-    -a --asynch               Process chunks asynchronously+    -j --jobs=INT              Number of jobs+       --cores=INT             Number of physical processors utilized+       --chunk=INT             Specify the length of chunks+    -a --asynch                Process chunks asynchronously -Miscellaneous: -    -d --debug=INT            debug level: 1, 2 or 3-    -n --no-quick             disable quick-search mode-    -? --help                 Display help message-    -V --version              Print version information+Miscellaneous: +    -d --debug=INT             Debug level: 1, 2 or 3+    -n --no-quick              Disable quick-search mode+    -? --help                  Display help message+    -V --version               Print version information+       --numeric-version       Print just the version number
cgrep.cabal view
@@ -1,6 +1,6 @@ Name:                cgrep Description:         Cgrep: a context-aware grep for source codes-Version:             6.5.15+Version:             6.6 Synopsis:            Command line tool Homepage:            http://awgn.github.io/cgrep/ License:             GPL-2
src/CGrep/Output.hs view
@@ -103,6 +103,7 @@     opt <- ask     case () of         _ | isJust $ format opt -> mapM formatOutput out+          | filename_only opt   -> filenameOutput out           | json opt            -> jsonOutput out           | xml opt             -> xmlOutput  out #ifdef ENABLE_HINT@@ -132,6 +133,10 @@         where fname | (Output f _ _ _) <- head outs = f               mkToken (n, xs) = "{ \"col\": " ++ show n ++ ", \"token\": " ++ show xs ++ " }"               mkMatch xs (Output _ n l ts) = xs ++ [ "{ \"row\": " ++ show n ++ ", \"tokens\": [" ++ intercalate "," (map mkToken ts) ++ "], \"line\":" ++ show l ++ "}" ]+++filenameOutput :: (Monad m) => [Output] -> ReaderT Options m [String]+filenameOutput outs = return $ nub $ map (\(Output fname _ _ _) -> fname) outs   xmlOutput :: (Monad m) => [Output] -> ReaderT Options m [String]
src/CmdOptions.hs view
@@ -37,6 +37,7 @@           ,     code = False                &= groupname "\nContext filters (generic)" &= help "Enable search in source code"     &= explicit &= name "c" &= name "code"           ,     comment = False             &= help "Enable search in comments"        &= explicit &= name "m" &= name "comment"           ,     literal = False             &= help "Enable search in string literals" &= explicit &= name "l" &= name "literal"+          ,     semantic = False            &= groupname "\nSemantic (generic)" &= help "\"code\" pattern: _, _1, _2... (identifiers), $, $1, $2... (optionals), ANY, KEY, STR, CHR, LIT, NUM, HEX, OCT, OR. -> e.g. \"_1(_1 && \\$)\" search for move constructors, \"struct OR class _ { OR : OR <\" search for a class declaration" &= explicit &= name "S" &= name "semantic"           ,     identifier = False          &= groupname "\nC/C++ language" &= help "Identifiers" &= explicit &= name "identifier"           ,     keyword = False             &= help "Keywords" &= explicit &= name "keyword"           ,     directive = False           &= help "Preprocessing directives" &= explicit &= name "directive"@@ -45,26 +46,26 @@           ,     string = False              &= help "Literal strings" &= explicit &= name "string"           ,     char = False                &= help "Literal chars" &= explicit &= name "char"           ,     oper = False                &= help "Operators" &= explicit &= name "oper"-          ,     semantic = False            &= groupname "\nSemantic (generic)" &= help "\"code\" pattern: _, _1, _2... (identifiers), $, $1, $2... (optionals), ANY, KEY, STR, CHR, LIT, NUM, HEX, OCT, OR. -> e.g. \"_1(_1 && \\$)\" search for move constructors, \"struct OR class _ { OR : OR <\" search for a class declaration" &= explicit &= name "S" &= name "semantic"-          ,     no_filename = False         &= groupname "\nOutput control"&= help "Suppress the file name prefix on output"  &= explicit &= name "h" &= name "no-filename"-          ,     no_linenumber= False        &= help "Suppress the line number on output lines" &= explicit &= name "N" &= name "no-linenumber"+          ,     max_count = maxBound        &= groupname "\nOutput control" &= help "Stop search in files after INT matches" &= explicit &= name "max-count"           ,     language_filter = []        &= help "Specify languages. ie: Cpp, +Haskell, -Makefile"           ,     language_force = Nothing    &= help "Force the language" &= explicit &= name "language-force"           ,     language_map = False        &= help "Lists the language mappings"           ,     magic_filter = []           &= help "Use unix magic as file-filter"-          ,     max_count = maxBound        &= help "Stop search in files after INT matches" &= explicit &= name "max-count"-          ,     count = False               &= help "Print only a count of matching lines per file" &= explicit &= name "count"+          ,     invert_match = False        &= help "Select non-matching lines" &= explicit &= name "invert-match" &= name "v"           ,     multiline = 1               &= help "Enable multi-line matching"           ,     recursive = False           &= help "Enable recursive search (don't follow symlinks)" &= explicit &= name "recursive" &= name "r"           ,     prune_dir = []              &= help "Do not descend into dir" &= explicit &= name "prune-dir"           ,     deference_recursive = False &= help "Recursive, follow symlinks" &= explicit &= name "deference-recursive" &= name "R"-          ,     invert_match = False        &= help "Select non-matching lines" &= explicit &= name "invert-match" &= name "v"+          ,     color = False               &= groupname "\nOutput format" &= help "Use colors to highlight the matching strings" &= explicit &= name "color"           ,     show_match = False          &= help "Show list of matching tokens" &= explicit &= name "show-match"-          ,     color = False               &= help "Use colors to highlight the matching strings" &= explicit &= name "color"-          ,     format = Nothing &= typ "STRING" &= help "Format output. Var: #f #n #l #t ## #, #; #0 #1...\ne.g. \"#f:#n #0 #1\"" &= explicit &= name "format"+          ,     no_filename = False         &= help "Suppress the file name prefix on output"  &= explicit &= name "h" &= name "no-filename"+          ,     no_linenumber= False        &= help "Suppress the line number on output lines" &= explicit &= name "N" &= name "no-linenumber"+          ,     count = False               &= help "Print only a count of matching lines per file" &= explicit &= name "count"+          ,     filename_only = False       &= help "Print only the name of files containing matches" &= explicit &= name "filename-only" #ifdef ENABLE_HINT           ,     hint = Nothing  &= typ "STRING" &= help "Haskell interpreter output. Var: file, row, line, tokens.\ne.g. \"file ++ show (tokens)\"" &= explicit &= name "hint" #endif+          ,     format = Nothing &= typ "STRING" &= help "Format output. Var: #f #n #l #t ## #, #; #0 #1...\ne.g. \"#f:#n #0 #1\"" &= explicit &= name "format"           ,     json = False                &= help "Format output as json object" &= explicit &= name "json"           ,     xml = False                 &= help "Format output as xml document" &= explicit &= name "xml"           ,     jobs   = 1                  &= groupname "\nConcurrency" &= help "Number of jobs"
src/Options.hs view
@@ -47,23 +47,24 @@     ,   string              :: Bool     ,   char                :: Bool     ,   oper                :: Bool-    -- Output:-    ,   no_filename         :: Bool-    ,   no_linenumber       :: Bool+    -- Output control:+    ,   max_count           :: Int     ,   language_filter     :: [String]     ,   language_force      :: Maybe String     ,   language_map        :: Bool     ,   magic_filter        :: [String]-    -- General:+    ,   invert_match        :: Bool     ,   multiline           :: Int     ,   recursive           :: Bool     ,   prune_dir           :: [FilePath]     ,   deference_recursive :: Bool-    ,   invert_match        :: Bool-    ,   max_count           :: Int-    ,   count               :: Bool-    ,   show_match          :: Bool+    -- Output format:     ,   color               :: Bool+    ,   show_match          :: Bool+    ,   no_filename         :: Bool+    ,   no_linenumber       :: Bool+    ,   count               :: Bool+    ,   filename_only       :: Bool #ifdef ENABLE_HINT     ,   hint                :: Maybe String #endif