haddocset 0.3.0 → 0.3.1
raw patch · 3 files changed
+22/−8 lines, 3 files
Files
- Documentation/Haddocset.hs +13/−4
- Main.hs +8/−3
- haddocset.cabal +1/−1
Documentation/Haddocset.hs view
@@ -46,13 +46,22 @@ then d else d P.<.> "docset" -globalPackageDirectory :: FilePath -> IO P.FilePath-globalPackageDirectory hcPkg =- P.decodeString . init . head . lines <$> readProcess hcPkg ["list"] ""+globalPackageDirectories :: FilePath -> IO [P.FilePath]+globalPackageDirectories hcPkg = do+ ds <- map (P.decodeString . init) . filter isPkgDBLine . lines <$>+ readProcess hcPkg ["list", "--global"] ""+ forM ds $ \d -> P.isDirectory d >>= \isDir ->+ if isDir+ then return d+ else return (P.directory d)+ where+ isPkgDBLine "" = False+ isPkgDBLine (' ':_) = False+ isPkgDBLine _ = True packageConfs :: P.FilePath -> IO [P.FilePath] packageConfs dir =- filter ((== Just "conf") . P.extension) <$> P.listDirectory dir+ filter (("package.cache" /=) . P.filename) <$> P.listDirectory dir data DocInfo = DocInfo { diPackageId :: PackageId
Main.hs view
@@ -35,9 +35,14 @@ Sql.execute_ conn "CREATE TABLE searchIndex(id INTEGER PRIMARY KEY, name TEXT, type TEXT, path TEXT, package TEXT);" Sql.execute_ conn "CREATE UNIQUE INDEX anchor ON searchIndex (name, type, path, package);" - globalDir <- globalPackageDirectory (optHcPkg o)- unless (optQuiet o) $ putStr " Global package directory: " >> putStrLn (P.encodeString globalDir)- globals <- map (globalDir P.</>) <$> packageConfs globalDir+ globalDirs <- globalPackageDirectories (optHcPkg o)+ unless (optQuiet o) $ do+ putStr " Global package directory: "+ putStr (P.encodeString $ head globalDirs)+ if length globalDirs > 1+ then putStr " and " >> putStr (show . pred $ length globalDirs) >> putStrLn "directories."+ else putStrLn ""+ globals <- concat <$> mapM (\d -> map (d P.</>) <$> packageConfs d) globalDirs let locals = toAddFiles $ optCommand o iFiles <- filter diExposed . catMaybes <$> mapM readDocInfoFile (globals ++ locals) unless (optQuiet o) $ putStr " Global package count: " >> print (length globals)
haddocset.cabal view
@@ -1,5 +1,5 @@ name: haddocset-version: 0.3.0+version: 0.3.1 synopsis: Generate docset of Dash by Haddock haskell documentation tool description: please read README.md <https://github.com/philopon/haddocset/blob/master/README.md> license: BSD3