packages feed

cgrep 6.6.20 → 6.6.22

raw patch · 6 files changed

+15/−16 lines, 6 files

Files

README.md view
@@ -7,7 +7,7 @@ Usage ----- -Cgrep 6.6.20. Usage: cgrep [OPTION] [PATTERN] files...+Cgrep 6.6.22. 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.20+Version:             6.6.22 Synopsis:            Command line tool Homepage:            http://awgn.github.io/cgrep/ License:             GPL-2
src/CGrep/Output.hs view
@@ -149,7 +149,7 @@                                                                        return $ map (\ys@(y:_) -> showFile conf opt y ++ ":" ++ show (length ys)) gs            |  Options{ count = True } <- opt -> do let gs = groupBy (\(Output f1 _ _ _) (Output f2 _ _ _) -> f1 == f2) xs-                                                  return $ map (\ys -> show (length ys)) gs+                                                  return $ map (show . length) gs           |  otherwise -> undefined  
src/CGrep/Strategy/BoyerMoore.hs view
@@ -71,7 +71,7 @@      putStrLevel1 $ "strategy  : running Boyer-Moore search on " ++ filename ++ "..." -    runSearch opt filename (all notNull shallow) $ do+    runSearch opt filename (any notNull shallow) $ do          -- print banners... 
src/Config.hs view
@@ -64,7 +64,7 @@     home  <- getHomeDirectory     confs <- filterM doesFileExist [cgreprc, "." ++ cgreprc, home </> "." ++ cgreprc, "/etc" </> cgreprc]     if notNull confs-        then liftM dropComments (readFile (head confs)) >>= \xs ->+        then fmap dropComments (readFile (head confs)) >>= \xs ->               return (prettyRead xs "Config error" :: Config, Just (head confs))         else return (defaultConfig, Nothing) 
src/Main.hs view
@@ -119,16 +119,13 @@ readPatternsFromFile :: FilePath -> IO [C.ByteString] readPatternsFromFile f =     if null f then return []-              else liftM (map trim8 . C.lines) $ C.readFile f+              else map trim8 . C.lines <$> C.readFile f  getFilePaths :: Bool        ->     -- pattern(s) from file-                Bool        ->     -- is terminal (no from STDIN)                 [String]    ->     -- list of patterns and files                 [String]--getFilePaths False True xs = if length xs == 1 then [ ] else tail xs-getFilePaths True  True xs = xs-getFilePaths _ False _ = [ ]+getFilePaths False xs = if length xs == 1 then [] else tail xs+getFilePaths True  xs = xs   parallelSearch :: [FilePath] -> [C.ByteString] -> [Lang] -> (Bool, Bool) -> OptionT IO ()@@ -240,15 +237,17 @@      -- display lang-map and exit... -    when (language_map opts) $ dumpLangMap langMap >> exitSuccess+    when (language_map opts) $+        dumpLangMap langMap >> exitSuccess -    -- check whether patterns list is empty, display help message if it's the case+    -- check whether the pattern list is empty, display help message if it's the case -    when (null (others opts) && (isTermIn && null (file opts))) $ withArgs ["--help"] $ void (cmdArgsRun options)+    when (null (others opts) && isTermIn && null (file opts)) $+        withArgs ["--help"] $ void (cmdArgsRun options)      -- load patterns: -    patterns <- if null (file opts) then return $ (if isTermIn then (:[]) . head else id) $ map (C.pack . UC.encodeString) (others opts)+    patterns <- if null (file opts) then return $ map (C.pack . UC.encodeString) (((:[]).head.others) opts)                                     else readPatternsFromFile $ file opts      let patterns' = map (if ignore_case opts then ic else id) patterns@@ -263,7 +262,7 @@      -- load files to parse: -    let paths = getFilePaths (not $ null (file opts)) isTermIn (others opts)+    let paths = getFilePaths (not $ null (file opts)) (others opts)      -- parse cmd line language list: