Format source code

This commit is contained in:
2017-11-12 11:25:42 +03:00
parent a14bdf1f53
commit 35025d9359
8 changed files with 170 additions and 180 deletions

View File

@ -1,26 +1,27 @@
module Main where
import System.Environment (getArgs)
import Text.Parsec.Error (ParseError)
import System.Exit
import System.Environment (getArgs)
import System.Exit
import Text.Parsec.Error (ParseError)
import Pattern
import Data.Dates
import Data.Dates
import Pattern
main :: IO ()
main = do
args <- getArgs
dt <- getCurrentDateTime
exitWith $ case processArgs args dt of
Just True -> ExitSuccess
Just False -> ExitFailure 1
Nothing -> ExitFailure 2
exitWith $
case processArgs args dt of
Just True -> ExitSuccess
Just False -> ExitFailure 1
Nothing -> ExitFailure 2
processArgs :: [String] -> DateTime -> Maybe Bool
processArgs [ptn] dt = safeMatch ptn dt
processArgs [ptn] dt = safeMatch ptn dt
processArgs [ptn, time] dt = matchGivenTime ptn (parseDate dt time)
processArgs _ _ = Nothing
processArgs _ _ = Nothing
matchGivenTime :: String -> Either ParseError DateTime -> Maybe Bool
matchGivenTime _ (Left _) = Nothing
matchGivenTime _ (Left _) = Nothing
matchGivenTime ptn (Right dt) = safeMatch ptn dt