From: Michael Orlitzky Date: Tue, 21 Aug 2012 17:02:59 +0000 (-0400) Subject: Make show_help work. X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=commitdiff_plain;h=95784f57c7cdd5f91c4fca86c11165723109f2a9;hp=5db94027e469f1187c33fbc64e3336cee0703742 Make show_help work. --- diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 2df29a5..0a31170 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -80,8 +80,8 @@ is_missing_arg_error s = startswith "Requires at least" s -show_help :: IO (CmdArgs Args) -show_help = withArgs ["--help"] parse_args +show_help :: IO Args +show_help = withArgs ["--help"] apply_args parse_args :: IO (CmdArgs Args) parse_args = do @@ -91,8 +91,9 @@ parse_args = do Right result -> return result Left err -> if (is_missing_arg_error err) then - -- Disregard the error message, show help instead. - show_help + -- Disregard the error message, show help instead. We can't + -- reuse show_help here because of its return type. + withArgs ["--help"] parse_args else do hPutStrLn stderr err exitWith (ExitFailure exit_args_parse_failed)