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)
33 database_help :: String
35 "The name of the database to which we should connect"
39 "Produce a detailed report listing all mailboxes by domain"
43 "Hostname where the database is located"
45 password_help :: String
47 "Password used to connect to the database"
51 "Port number used to connect to the database"
53 username_help :: String
55 "Username used to connect to the database"
57 arg_spec :: OptionalConfiguration
58 arg_spec = OptionalConfiguration
59 { database = def &= help database_help,
60 detail = def &= help detail_help,
61 host = def &= help host_help,
62 password = def &= help password_help,
63 port = def &= help port_help,
64 username = def &= help username_help }
65 &= program program_name
67 &= details [description]
69 get_args :: IO OptionalConfiguration
70 get_args = cmdArgs arg_spec