5 import System.Console.CmdArgs (
15 -- Get the version from Cabal.
16 import Paths_mailbox_count ( version )
17 import Data.Version ( showVersion )
19 import OptionalConfiguration ( OptionalConfiguration(..) )
23 description = "Count mailboxes in a SQL database."
25 program_name :: String
26 program_name = "mailbox-count"
29 my_summary = program_name ++ "-" ++ (showVersion version)
31 database_help :: String
33 "The name of the database to which we should connect"
37 "Produce a detailed report listing all mailboxes by domain"
41 "Hostname where the database is located"
43 password_help :: String
45 "Password used to connect to the database"
49 "Port number used to connect to the database"
51 username_help :: String
53 "Username used to connect to the database"
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
65 &= details [description]
67 get_args :: IO OptionalConfiguration
68 get_args = cmdArgs arg_spec