neil 0.3 → 0.4
raw patch · 2 files changed
+10/−3 lines, 2 files
Files
- neil.cabal +1/−1
- src/Cabal.hs +9/−2
neil.cabal view
@@ -1,7 +1,7 @@ cabal-version: >= 1.6 build-type: Simple name: neil-version: 0.3+version: 0.4 license: BSD3 license-file: LICENSE category: Development
src/Cabal.hs view
@@ -88,8 +88,8 @@ run Docs{..} = Just $ do src <- readCabal- let [ver] = [trim $ drop 8 x | x <- lines src, "version:" `isPrefixOf` x]- let [name] = [trim $ drop 5 x | x <- lines src, "name:" `isPrefixOf` x]+ let ver = extractCabal "version" src+ let name = extractCabal "name" src system_ $ "cabal haddock --hoogle --hyperlink-source " ++ "--contents-location=/package/" ++ name withTempDir $ \dir -> do@@ -186,6 +186,13 @@ case file of Nothing -> return [] Just file -> readFile' file++extractCabal :: String -> String -> String+extractCabal find = f . words . replace ":" " : "+ where+ f (name:":":val:_) | lower find == lower name = val+ f (x:xs) = f xs+ f [] = error "Failed to find the Cabal key " ++ find findCabal :: IO (Maybe FilePath)