#!/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 parse _ = putStrLn "Invalid argument." >> usage >> exit usage = putStrLn "Usage: monadoro [-vh] [--session]" version = putStrLn "Monadoro 2.1.2" exit = exitWith ExitSuccess die = exitWith (ExitFailure 1)