module CommandLine ( get_args ) where import System.Console.CmdArgs ( (&=), cmdArgs, def, details, help, program, summary, typ, typDir ) -- Get the version from Cabal. import Paths_htsn (version) import Data.Version (showVersion) import OptionalConfiguration (OptionalConfiguration(..)) description :: String description = "Parse XML files from The Sports Network." program_name :: String program_name = "htsn" my_summary :: String my_summary = program_name ++ "-" ++ (showVersion version) password_help :: String password_help = "Password to use when connecting to the feed" output_directory_help :: String output_directory_help = "Directory in which to output the XML files; must be writable" username_help :: String username_help = "Username to use when connecting to the feed" arg_spec :: OptionalConfiguration arg_spec = OptionalConfiguration { password = def &= typ "PASSWORD" &= help password_help, output_directory = def &= typDir &= help output_directory_help, username = def &= typ "USERNAME" &= help username_help, feed_hosts = def &= typ "HOSTNAMES" } &= program program_name &= summary my_summary &= details [description] get_args :: IO OptionalConfiguration get_args = cmdArgs arg_spec