git.iko.soy/rowtype-yoga/purescript-native
on golang help sign in
Globs for all
8e7adc3Phil Freeman
hierarchy/Main.hs+9−5
@@ -13,6 +13,8 @@
13--
13--
14-----------------------------------------------------------------------------
14-----------------------------------------------------------------------------
15
15
16+{-# LANGUAGE TupleSections #-}
17+
16module Main where
18module Main where
17
19
18import Control.Monad (unless)
20import Control.Monad (unless)
@@ -24,6 +26,7 @@ import Data.Version (showVersion)
24import Options.Applicative
26import Options.Applicative
25import System.Directory (createDirectoryIfMissing)
27import System.Directory (createDirectoryIfMissing)
26import System.FilePath ((</>))
28import System.FilePath ((</>))
29+import System.FilePath.Glob (glob)
27import System.Exit (exitFailure, exitSuccess)
30import System.Exit (exitFailure, exitSuccess)
28import System.IO (hPutStr, stderr)
31import System.IO (hPutStr, stderr)
29
32
@@ -50,13 +53,14 @@ instance Ord SuperMap where
50runModuleName :: P.ModuleName -> String
53runModuleName :: P.ModuleName -> String
51runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
54runModuleName (P.ModuleName pns) = intercalate "_" (P.runProperName `map` pns)
52
55
53−readInput :: FilePath -> IO (Either P.MultipleErrors [P.Module])
56+readInput :: [FilePath] -> IO (Either P.MultipleErrors [P.Module])
54−readInput filename = do
57+readInput paths = do
55− content <- readFile filename
58+ content <- mapM (\path -> (path, ) <$> readFile path) paths
56− return $ map snd <$> P.parseModulesFromFiles id [(filename, content)]
59+ return $ map snd <$> P.parseModulesFromFiles id content
57
60
58compile :: HierarchyOptions -> IO ()
61compile :: HierarchyOptions -> IO ()
59−compile (HierarchyOptions input mOutput) = do
62+compile (HierarchyOptions inputGlob mOutput) = do
63+ input <- glob inputGlob
60 modules <- readInput input
64 modules <- readInput input
61 case modules of
65 case modules of
62 Left errs -> hPutStr stderr (P.prettyPrintMultipleErrors False errs) >> exitFailure
66 Left errs -> hPutStr stderr (P.prettyPrintMultipleErrors False errs) >> exitFailure
psc-docs/Main.hs+3−1
@@ -34,6 +34,7 @@ import System.Exit (exitFailure)
34import System.IO (hPutStrLn, stderr)
34import System.IO (hPutStrLn, stderr)
35import System.Directory (createDirectoryIfMissing)
35import System.Directory (createDirectoryIfMissing)
36import System.FilePath (takeDirectory)
36import System.FilePath (takeDirectory)
37+import System.FilePath.Glob (glob)
37
38
38import Etags
39import Etags
39import Ctags
40import Ctags
@@ -61,7 +62,8 @@ data PSCDocsOptions = PSCDocsOptions
61 deriving (Show)
62 deriving (Show)
62
63
63docgen :: PSCDocsOptions -> IO ()
64docgen :: PSCDocsOptions -> IO ()
64−docgen (PSCDocsOptions fmt input output) =
65+docgen (PSCDocsOptions fmt inputGlob output) = do
66+ input <- concat <$> mapM glob inputGlob
65 case fmt of
67 case fmt of
66 Etags -> dumpTags input dumpEtags
68 Etags -> dumpTags input dumpEtags
67 Ctags -> dumpTags input dumpCtags
69 Ctags -> dumpTags input dumpCtags
purescript.cabal+4−3
@@ -185,8 +185,8 @@ executable psci
185executable psc-docs
185executable psc-docs
186 build-depends: base >=4 && <5, purescript -any,
186 build-depends: base >=4 && <5, purescript -any,
187 optparse-applicative >= 0.10.0, process -any, mtl -any,
187 optparse-applicative >= 0.10.0, process -any, mtl -any,
188− split -any, ansi-wl-pprint -any, directory -any, filepath
188+ split -any, ansi-wl-pprint -any, directory -any,
189− -any
189+ filepath -any, Glob -any
190 main-is: Main.hs
190 main-is: Main.hs
191 buildable: True
191 buildable: True
192 hs-source-dirs: psc-docs
192 hs-source-dirs: psc-docs
@@ -213,7 +213,8 @@ executable psc-publish
213
213
214executable psc-hierarchy
214executable psc-hierarchy
215 build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,
215 build-depends: base >=4 && <5, purescript -any, optparse-applicative >= 0.10.0,
216− process -any, mtl -any, parsec -any, filepath -any, directory -any
216+ process -any, mtl -any, parsec -any, filepath -any, directory -any,
217+ Glob -any
217 main-is: Main.hs
218 main-is: Main.hs
218 buildable: True
219 buildable: True
219 hs-source-dirs: hierarchy
220 hs-source-dirs: hierarchy