1 {-# LANGUAGE DeriveDataTypeable #-}
7 import System.Console.CmdArgs (
17 -- Get the version from Cabal.
18 import Paths_mailbox_count ( version )
19 import Data.Version ( showVersion )
21 import OptionalConfiguration ( OptionalConfiguration(..) )
25 description = "Count mailboxes in a SQL database."
27 program_name :: String
28 program_name = "mailbox-count"
31 my_summary = program_name ++ "-" ++ (showVersion version)
35 "Produce both summary and detailed reports"
37 database_help :: String
39 "The name of the database to which we should connect"
43 "Produce a detailed report listing all mailboxes by domain"
47 "Hostname where the database is located"
49 password_help :: String
51 "Password used to connect to the database"
55 "Port number used to connect to the database"
57 username_help :: String
59 "Username used to connect to the database"
61 arg_spec :: OptionalConfiguration
62 arg_spec = OptionalConfiguration
63 { both = def &= help both_help,
64 database = def &= help database_help,
65 detail = def &= help detail_help,
66 host = def &= help host_help,
67 password = def &= help password_help,
68 port = def &= help port_help,
69 username = def &= help username_help }
70 &= program program_name
72 &= details [description]
74 get_args :: IO OptionalConfiguration
75 get_args = cmdArgs arg_spec