]> gitweb.michael.orlitzky.com - mailbox-count.git/blob - src/CommandLine.hs
Fix hlint suggestions.
[mailbox-count.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
14
15 -- Get the version from Cabal.
16 import Paths_mailbox_count ( version )
17 import Data.Version ( showVersion )
18
19 import OptionalConfiguration ( OptionalConfiguration(..) )
20
21
22 description :: String
23 description = "Count mailboxes in a SQL database."
24
25 program_name :: String
26 program_name = "mailbox-count"
27
28 my_summary :: String
29 my_summary = program_name ++ "-" ++ (showVersion version)
30
31 database_help :: String
32 database_help =
33 "The name of the database to which we should connect"
34
35 detail_help :: String
36 detail_help =
37 "Produce a detailed report listing all mailboxes by domain"
38
39 host_help :: String
40 host_help =
41 "Hostname where the database is located"
42
43 password_help :: String
44 password_help =
45 "Password used to connect to the database"
46
47 port_help :: String
48 port_help =
49 "Port number used to connect to the database"
50
51 username_help :: String
52 username_help =
53 "Username used to connect to the database"
54
55 arg_spec :: OptionalConfiguration
56 arg_spec = OptionalConfiguration
57 { database = def &= help database_help,
58 detail = def &= help detail_help,
59 host = def &= help host_help,
60 password = def &= help password_help,
61 port = def &= help port_help,
62 username = def &= help username_help }
63 &= program program_name
64 &= summary my_summary
65 &= details [description]
66
67 get_args :: IO OptionalConfiguration
68 get_args = cmdArgs arg_spec