X-Git-Url: http://gitweb.michael.orlitzky.com/?p=dead%2Fhtsn.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=071c5209307116787404555eecfa941b22b1488a;hp=40a1ac887fe3a78de7fa762f8290e3a655ee4248;hb=a2c2a1a6865be7b4cd17fb72de635bb9385728b9;hpb=95e23e65db31cf51c9f207a6b447da19920ee1a1 diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 40a1ac8..071c520 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -1,3 +1,5 @@ +-- | Parse the command-line options, and display help text if +-- necessary. module CommandLine ( get_args ) where @@ -13,33 +15,44 @@ import System.Console.CmdArgs ( typ, typDir ) --- Get the version from Cabal. +-- This let's us get the version from Cabal. import Paths_htsn (version) import Data.Version (showVersion) import OptionalConfiguration (OptionalConfiguration(..)) + +-- | The description of the program, displayed as part of the help. description :: String description = "Parse XML files from The Sports Network." +-- | The name of this program. program_name :: String program_name = "htsn" +-- | A summary string output as part of the help. my_summary :: String my_summary = program_name ++ "-" ++ (showVersion version) + +-- | A description of the "password" option. password_help :: String password_help = "Password to use when connecting to the feed" +-- | A description of the "output_directory" option. output_directory_help :: String output_directory_help = "Directory in which to output the XML files; must be writable" +-- | A description of the "username" option. username_help :: String username_help = "Username to use when connecting to the feed" +-- | A data structure representing the possible command-line +-- options. The CmdArgs library is doing heavy magic beneath the +-- hood here. arg_spec :: OptionalConfiguration arg_spec = OptionalConfiguration { @@ -52,6 +65,7 @@ arg_spec = &= details [description] - +-- | A convenience function; our only export. Meant to be used in +-- 'main' to retrieve the command-line arguments. get_args :: IO OptionalConfiguration get_args = cmdArgs arg_spec