X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Flwn-epub.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=4fd9a542d600e8a41c9c74498ccd153fda013a7c;hp=a61cc30e46b570a34f6541e68a39f1368a5a8677;hb=6789361c1ee570df06878535aff73d99b87528a5;hpb=14bff4a492037f8921a5993931d0fc4363207b20 diff --git a/src/CommandLine.hs b/src/CommandLine.hs index a61cc30..4fd9a54 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -1,6 +1,6 @@ {-# LANGUAGE DeriveDataTypeable #-} -module CommandLine (Args(..), apply_args) +module CommandLine (Args(..), apply_args, show_help) where -- Get the version from Cabal. @@ -71,6 +71,9 @@ is_missing_arg_error s = startswith "Requires at least" s +show_help :: IO (CmdArgs Args) +show_help = withArgs ["--help"] parse_args + parse_args :: IO (CmdArgs Args) parse_args = do x <- getArgs @@ -80,7 +83,7 @@ parse_args = do Left err -> if (is_missing_arg_error err) then -- Disregard the error message, show help instead. - withArgs ["--help"] parse_args + show_help else do hPutStrLn stderr err exitWith (ExitFailure exit_args_parse_failed)