diff options
Diffstat (limited to 'Biz/Devalloc.hs')
-rw-r--r-- | Biz/Devalloc.hs | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/Biz/Devalloc.hs b/Biz/Devalloc.hs index 6da2ff6..1134098 100644 --- a/Biz/Devalloc.hs +++ b/Biz/Devalloc.hs @@ -6,6 +6,7 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE NamedFieldPuns #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuasiQuotes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TypeFamilies #-} @@ -18,6 +19,7 @@ -- : out devalloc -- : dep acid-state -- : dep clay +-- : dep docopt -- : dep envy -- : dep github -- : dep ixset @@ -41,6 +43,7 @@ where import Alpha hiding ((<.>)) import Biz.App (CSS (..), HtmlApp (..)) +import qualified Biz.Cli as Cli import qualified Biz.Look import qualified Clay import qualified Control.Exception as Exception @@ -192,7 +195,22 @@ upsertGitHubUser keep tok ghUser = case GitHub.userEmail ghUser of -- * main and test main :: IO () -main = Exception.bracket startup shutdown run +main = Cli.main <| Cli.Plan help move test + +help :: Cli.Docopt +help = + [Cli.docopt| +devalloc + +Usage: + devalloc [--test] + +Options: + --test Run the tests +|] + +move :: Cli.Arguments -> IO () +move _ = Exception.bracket startup shutdown run where startup = do cfg <- Envy.decodeWithDefaults Envy.defConfig @@ -232,8 +250,8 @@ testCookieSettings = Auth.cookieXsrfSetting = Nothing } -test :: IO Analysis -test = test_analyzeGitHub +test :: Cli.Arguments -> IO () +test _ = test_analyzeGitHub >> pure test_calculateScore >> pure () -- * app configurations @@ -742,6 +760,7 @@ calculateScore numTotal numBlackholes numLiabilities = numGood = numTotal - numBlackholes - numLiabilities maxScore = 100.0 +test_calculateScore :: [Bool] test_calculateScore = [ -- perfect 100 == calculateScore 100 0 0, |