From 31cad52b14220a536b42b99f5c5a882c2ba27697 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 22 Jul 2021 19:26:34 +0100 Subject: (Main)~restructured main to be a bit smarter Decompose args list via case so some arguments can be handled ahead of time. --- Main.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Main.hs b/Main.hs index cfe5669..e8b2927 100644 --- a/Main.hs +++ b/Main.hs @@ -63,7 +63,7 @@ flagHandler _ _ = main = do args <- getArgs - if (length args) == 0 - then putStrLn $ errorMessage "" - else - putStrLn $ flagHandler (head args) (tail args) + putStr $ + case args of + [] -> errorMessage "" + (x: xs) -> if x == "-help" then errorMessage "" else flagHandler x xs -- cgit v1.2.3-13-gbd6f