Monadoro-0.2.1.0: src/ArgParse.hs
#!/usr/bin/env stack
--stack --install-ghc runghc
module ArgParse (parse_args) where
-- Here we will service arguments passed to the program in the simplest manner
-- possible.
import System.Environment
import System.Exit
import Pomodoro (worker)
import Clock (countdown)
main = parse_args
parse_args = getArgs >>= parse
parse ["-h"] = usage >> exit
parse ["-v"] = version >> exit
parse ["--session"] = worker
parse [] = countdown
usage = putStrLn "Usage: monadoro [-vh] [--session]"
version = putStrLn "Monadoro 2.1.0"
exit = exitWith ExitSuccess
die = exitWith (ExitFailure 1)