Browse files

options: treat unknown commandline options as fatal errors

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
1 parent eae1ca0 commit d00bfa5640837a0513bcb126a0c9a10a695b30a8 @trofi trofi committed Apr 30, 2012
Showing with 3 additions and 5 deletions.
  1. +3 −5 Main.hs
View
8 Main.hs
@@ -140,11 +140,9 @@ argParser :: PkgManager -> ([Flag], [String], [String], [Stri
-> IO (RunModifier, Action)
argParser dPM (fls, nonoptions, unrecognized, []) =
do unless (null unrecognized)
- $ putErrLn
- $ unwords $ "Unknown options:" : unrecognized
+ $ die $ unwords $ "Unknown options:" : unrecognized
unless (null bPms)
- $ putErrLn
- $ unwords $ "Unknown package managers:" : bPms
+ $ die $ unwords $ "Unknown package managers:" : bPms
return (rm, a)
where
(fls', as) = partitionBy flagToAction fls
@@ -257,7 +255,7 @@ success msg = do putStrLn msg
exitWith ExitSuccess
die :: String -> IO a
-die msg = do putErrLn msg
+die msg = do putErrLn ("ERROR: " ++ msg)
exitWith (ExitFailure 1)
putErrLn :: String -> IO ()

0 comments on commit d00bfa5

Please sign in to comment.