Support running the dependency runner from the command line
Will fail currently
This commit is contained in:
parent
d3b32398b5
commit
67447ac23b
|
@ -1,7 +1,7 @@
|
|||
module DependencyRunner
|
||||
( DepRunM
|
||||
, runDeps
|
||||
, runDepRunM
|
||||
, runDepRunMIO
|
||||
) where
|
||||
|
||||
import Types (Value(..), Valuable(..))
|
||||
|
@ -19,8 +19,8 @@ newtype DepRunM a = DepRunM { unDepRunM :: StateT (Map Int Value) IO a }
|
|||
runDeps :: [Dependency] -> DepRunM ()
|
||||
runDeps = mapM_ runDep
|
||||
|
||||
runDepRunM :: DepRunM a -> IO a
|
||||
runDepRunM m = evalStateT (unDepRunM m) M.empty
|
||||
runDepRunMIO :: DepRunM a -> IO a
|
||||
runDepRunMIO m = evalStateT (unDepRunM m) M.empty
|
||||
|
||||
runDep :: Dependency -> DepRunM ()
|
||||
runDep (Dependency a action b) = do
|
||||
|
|
|
@ -4,7 +4,9 @@ module Main where
|
|||
import Types.Dependency (Dependency, formatDependencyTrees)
|
||||
import DependencyGenerator (evalDepGenM)
|
||||
import SiteGenerator (generateSite)
|
||||
import DependencyRunner (runDeps, runDepRunMIO)
|
||||
|
||||
import System.Environment (getArgs)
|
||||
import qualified Data.Text.IO as T
|
||||
import Language.Haskell.TH.Syntax (lift)
|
||||
|
||||
|
@ -12,4 +14,12 @@ dependencies :: [Dependency]
|
|||
dependencies = $(lift (evalDepGenM generateSite))
|
||||
|
||||
main :: IO ()
|
||||
main = T.putStr $ formatDependencyTrees dependencies
|
||||
main = do
|
||||
args <- getArgs
|
||||
case args of
|
||||
["run"] ->
|
||||
runDepRunMIO $ runDeps dependencies
|
||||
["tree"] ->
|
||||
T.putStr $ formatDependencyTrees dependencies
|
||||
_ ->
|
||||
error "unexpected arguments"
|
||||
|
|
Loading…
Reference in New Issue