aboutsummaryrefslogtreecommitdiff
path: root/Main.hs
diff options
context:
space:
mode:
authorAryadev Chavali <aryadev@aryadevchavali.com>2021-07-22 19:26:34 +0100
committerAryadev Chavali <aryadev@aryadevchavali.com>2021-07-22 19:26:34 +0100
commit31cad52b14220a536b42b99f5c5a882c2ba27697 (patch)
tree39eadc2e117901efce295e954df26ddefaf4eebd /Main.hs
parent09322b68fd943ec83e616145afd71ea4f080ea17 (diff)
downloadnumberdisplay-31cad52b14220a536b42b99f5c5a882c2ba27697.tar.gz
numberdisplay-31cad52b14220a536b42b99f5c5a882c2ba27697.tar.bz2
numberdisplay-31cad52b14220a536b42b99f5c5a882c2ba27697.zip
(Main)~restructured main to be a bit smarter
Decompose args list via case so some arguments can be handled ahead of time.
Diffstat (limited to 'Main.hs')
-rw-r--r--Main.hs8
1 files 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