diff options
Diffstat (limited to 'chip')
-rwxr-xr-x | chip/make | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -49,6 +49,9 @@ main = do void $ addWatch inotify [Modify] (pack arg) (const notify) forever $ wait >> bild app >> say "waiting..." Make -> bild app + Tidy -> do + callCommand "rm -rf bild/*" + say "made: tidy" bild :: App -> IO () bild app = do @@ -63,17 +66,21 @@ say = putStrLn nop :: SomeException -> IO () nop _ = pure () -data Action = Make | Rise + +data Action = Make | Rise | Tidy parseArgs :: [String] -> (App, Action) -parseArgs [] = errorWithoutStackTrace "usage: chip/make [make|rise] <app>" +parseArgs [] = errorWithoutStackTrace "usage: chip/make [make|rise|tidy] <app>" parseArgs (act:name:_) = ( App (lowercase name) (capitalize name) , case lowercase act of "rise" -> Rise + "tidy" -> Tidy _ -> Make ) -parseArgs (name:_) = (App (lowercase name) (capitalize name), Make) +parseArgs (name:_) = case name of + "tidy" -> (App (lowercase "") (capitalize ""), Tidy) + _ -> (App (lowercase name) (capitalize name), Make) capitalize, lowercase :: String -> String capitalize (α:ω) = Char.toUpper α : map Char.toLower ω |