]> gitweb.michael.orlitzky.com - dead/htsn.git/blob - src/CommandLine.hs
Use the round-robin approach to choosing a hostname.
[dead/htsn.git] / src / CommandLine.hs
1 module CommandLine (
2 get_args )
3 where
4
5 import System.Console.CmdArgs (
6 (&=),
7 cmdArgs,
8 def,
9 details,
10 help,
11 program,
12 summary,
13 typ,
14 typDir )
15
16 -- Get the version from Cabal.
17 import Paths_htsn (version)
18 import Data.Version (showVersion)
19
20 import OptionalConfiguration (OptionalConfiguration(..))
21
22 description :: String
23 description = "Parse XML files from The Sports Network."
24
25 program_name :: String
26 program_name = "htsn"
27
28 my_summary :: String
29 my_summary = program_name ++ "-" ++ (showVersion version)
30
31 password_help :: String
32 password_help =
33 "Password to use when connecting to the feed"
34
35 output_directory_help :: String
36 output_directory_help =
37 "Directory in which to output the XML files; must be writable"
38
39 username_help :: String
40 username_help =
41 "Username to use when connecting to the feed"
42
43 arg_spec :: OptionalConfiguration
44 arg_spec =
45 OptionalConfiguration {
46 password = def &= typ "PASSWORD" &= help password_help,
47 output_directory = def &= typDir &= help output_directory_help,
48 username = def &= typ "USERNAME" &= help username_help,
49 -- Using "def" below for the FeedHosts causes the list to show up in
50 -- reverse. Don't ask me why.
51 feed_hosts = def &= typ "HOSTNAMES" }
52 &= program program_name
53 &= summary my_summary
54 &= details [description]
55
56
57
58 get_args :: IO OptionalConfiguration
59 get_args = cmdArgs arg_spec