packages feed

hscope 0.1 → 0.1.1

raw patch · 3 files changed

+16/−7 lines, 3 files

Files

HScope.hs view
@@ -18,6 +18,7 @@ import Control.Applicative ((<$>), (<*>)) import System.IO (hFlush, stdout) import Data.Generics.Uniplate.Data (transformBiM)+import System.Directory (doesFileExist) import Data.Data  data Flag = Build Bool | File FilePath | Line | Query String | CPPInclude String deriving (Show)@@ -183,12 +184,17 @@ main = do     (flags, rest, _) <- fmap (getOpt Permute options) getArgs     let cfg = parseFlags flags-    when (cBuild cfg) $ cdbMake (cFile cfg) $ mapM_ (buildOne cfg) rest+    when (cBuild cfg) $ do+        if null rest then putStrLn $ "Please provide files to build the hscope database"+                     else cdbMake (cFile cfg) $ mapM_ (buildOne cfg) rest     if null flags then usage else go cfg     where usage = do             pn <- getProgName             putStrLn $ usageInfo ("Usage: " ++ pn ++ " [OPTION...] files...") options           go cfg = do-            cdb <- cdbInit $ cFile cfg-            maybe (return ()) (handleQuery cdb) $ cQuery cfg-            when (cLine cfg) $ runLines cdb+            b <- doesFileExist $ cFile cfg+            if b then do+                    cdb <- cdbInit $ cFile cfg+                    maybe (return ()) (handleQuery cdb) $ cQuery cfg+                    when (cLine cfg) $ runLines cdb+                 else putStrLn $ cFile cfg ++ " does not exist"
hscope.cabal view
@@ -1,5 +1,5 @@ Name:           hscope-Version:        0.1+Version:        0.1.1 License:        BSD3 License-File:   COPYING Category:       source-tools@@ -37,7 +37,7 @@     Main-Is: HScope.hs     GHC-Options: -Wall     Build-Depends: base (< 5), hs-cdb, haskell-src-exts, mtl, uniplate, cereal-                             , vector, bytestring, process+                             , vector, bytestring, process, directory     Default-Language: Haskell2010  test-suite Build
t/Build.hs view
@@ -23,7 +23,7 @@  main :: IO () main = withTemporaryDirectory "/tmp/hscope_test_XXXXXX" $ \td -> testSimpleMain $ do-    plan 42+    plan 43     hpath <- liftIO $ canonicalizePath "./dist/build/hscope/hscope"     tfile <- liftIO $ canonicalizePath "./t/files/Simple.hs"     ec1 <- liftIO $ system $ "cd " ++ td ++ " && " ++ hpath ++ " -b " ++ tfile@@ -125,5 +125,8 @@      res16 <- liftIO $ readProcess hpath [] ""     is res16 res15++    res17 <- liftIO $ readProcess hpath [ "--build" ] ""+    like res17 $ "Please provide files to build the hscope database"      return ()