From ea1b81977d6c4d60e6c0764477a11dcb232c7b9d Mon Sep 17 00:00:00 2001 From: Ben Sima Date: Thu, 29 Aug 2019 06:21:18 -0700 Subject: reorder args to chip/make --- chip/make | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/chip/make b/chip/make index d221dfa..439cf46 100755 --- a/chip/make +++ b/chip/make @@ -5,10 +5,10 @@ {-# OPTIONS_GHC -Wall #-} {- --- TODO: rewrite this in using shake --- [ ] https://hackage.haskell.org/package/shake-0.17.7/docs/Development-Shake.html --- [ ] make it optionally run the built program too, like entr --- [ ] generate tags each time it's rebuilt +TODO: rewrite this in using shake +- [ ] https://hackage.haskell.org/package/shake-0.17.7/docs/Development-Shake.html +- [ ] make it optionally run the built program too, like entr +- [ ] generate tags each time it's rebuilt -} module Main where @@ -29,9 +29,8 @@ data Notify = Notify , wait :: IO () } --- | Skip channel to model concurrency semantics --- This ensures that we don't execute more than one command --- at a time. +-- | skip channel to model concurrency semantics. this ensures that we don't +-- execute more than one command at a time. initNotify :: IO Notify initNotify = do mvar <- newMVar () @@ -43,7 +42,7 @@ main :: IO () main = do (app, act) <- parseArgs <$> getArgs case act of - Watch -> do + Rise -> do inotify <- initINotify Notify {..} <- initNotify dirs <- nub . concat <$> mapM getDirs ["aero", "apex", "lore"] @@ -64,14 +63,14 @@ say = putStrLn nop :: SomeException -> IO () nop _ = pure () -data Action = Make | Watch +data Action = Make | Rise parseArgs :: [String] -> (App, Action) -parseArgs [] = errorWithoutStackTrace "usage: chip/make [watch]" -parseArgs (name:act:_) = +parseArgs [] = errorWithoutStackTrace "usage: chip/make [make|rise] " +parseArgs (act:name:_) = ( App (lowercase name) (capitalize name) , case lowercase act of - "watch" -> Watch + "rise" -> Rise _ -> Make ) parseArgs (name:_) = (App (lowercase name) (capitalize name), Make) @@ -90,6 +89,7 @@ data App = App ghcopts :: String ghcopts = "-odir bild/ -hidir bild/ -Wall" +-- | compile with ghc. apex :: App -> IO () apex App {..} = callCommand $ intercalate " " [ "ghc" @@ -100,6 +100,7 @@ apex App {..} = callCommand $ intercalate " " , "-o bild/" ++ name ] +-- | compile with ghcjs. aero :: App -> IO () aero App {..} = callCommand $ intercalate " " [ "ghcjs" -- cgit v1.2.3