packages feed

cgrep 6.6.1 → 6.6.2

raw patch · 5 files changed

+34/−12 lines, 5 files

Files

README.md view
@@ -1,10 +1,13 @@-CGrep: a context-aware grep for source codes [![Hackage](https://img.shields.io/hackage/v/cgrep.svg?style=flat)](https://hackage.haskell.org/package/cgrep)+CGrep: a context-aware grep for source codes  ============================================ +[![Hackage](https://img.shields.io/hackage/v/cgrep.svg?style=flat)](https://hackage.haskell.org/package/cgrep) +[![Join the chat at https://gitter.im/awgn/cgrep](https://badges.gitter.im/awgn/cgrep.svg)](https://gitter.im/awgn/cgrep?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)+ Usage ----- -Cgrep 6.6.1. Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.6.2. Usage: cgrep [OPTION] [PATTERN] files...  cgrep [OPTIONS] [ITEM] 
cgrep.cabal view
@@ -1,6 +1,6 @@ Name:                cgrep Description:         Cgrep: a context-aware grep for source codes-Version:             6.6.1+Version:             6.6.2 Synopsis:            Command line tool Homepage:            http://awgn.github.io/cgrep/ License:             GPL-2
src/CGrep/Output.hs view
@@ -1,4 +1,3 @@--- -- Copyright (c) 2013 Bonelli Nicola <bonelli@antifork.org> -- -- This program is free software; you can redistribute it and/or modify@@ -21,7 +20,8 @@                      putPrettyHeader,                      putPrettyFooter,                      prettyOutput,-                     showFile) where+                     showFile,+                     showBold) where  import qualified Data.ByteString.Char8 as C import System.Console.ANSI@@ -209,6 +209,15 @@ resetTerm = setSGRCode []  +type ColorString = String+++showColor :: Options -> ColorString -> String -> String+showColor Options { color = c, no_color = c'} colorCode f+    | c && not c'= colorCode ++ f ++ resetTerm+    | otherwise  = f++ showTokens :: Options -> [Token] -> String showTokens Options { show_match = st } xs     | st        = show (map snd xs)@@ -216,9 +225,11 @@   showFile :: Options -> String -> String-showFile Options { color = c, no_color = c'} f-    | c && not c'= bold ++ blue ++ f ++ resetTerm-    | otherwise  = f+showFile opt = showColor opt (bold ++ blue)+++showBold :: Options -> String -> String+showBold opt = showColor opt bold   showLine :: Options -> [Token] -> Line8 -> String
src/Config.hs view
@@ -46,13 +46,13 @@     where notComment = (not . ("#" `isPrefixOf`)) . dropWhile isSpace  -getConfig :: IO Config+getConfig :: IO (Config, Maybe FilePath) getConfig = do     home  <- getHomeDirectory     confs <- filterM doesFileExist [cgreprc, "." ++ cgreprc, home </> "." ++ cgreprc, "/etc" </> cgreprc]     if notNull confs         then liftM dropComments (readFile (head confs)) >>= \xs ->-              return (prettyRead xs "Config error" :: Config)-        else return $ Config [] [] False+              return ((prettyRead xs "Config error" :: Config), Just (head confs))+        else return $ (Config [] [] False, Nothing)  
src/Main.hs view
@@ -196,7 +196,7 @@      -- read Cgrep config options -    conf  <- getConfig+    (conf, confpath)  <- getConfig      -- read command-line options @@ -234,6 +234,11 @@                      | otherwise = C.map toLower                         where wildCardTokens = "OR" : M.keys wildCardMap   -- "OR" is not included in wildCardMap +    -- display the configuration in use++    when (isJust confpath) $+      putStrLn $ showBold opts ("Using '" ++ (fromJust confpath) ++ "' configuration file...")+     -- load files to parse:      let paths = getFilePaths (not $ null (file opts)) isTermIn (others opts)@@ -259,5 +264,8 @@      when (cores opts /= 0) $ setNumCapabilities (cores opts) +    -- run search+     runReaderT (parallelSearch conf paths patterns' langs (isTermIn, isTermOut)) opts+