]> gitweb.michael.orlitzky.com - dead/lwn-epub.git/blobdiff - src/CommandLine.hs
Begin working on determining the article argument type.
[dead/lwn-epub.git] / src / CommandLine.hs
index a61cc30e46b570a34f6541e68a39f1368a5a8677..4fd9a542d600e8a41c9c74498ccd153fda013a7c 100644 (file)
@@ -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)