5 import System.Console.CmdArgs (
15 -- Get the version from Cabal.
16 import Paths_list_remote_forwards ( version )
17 import Data.Version ( showVersion )
19 import OptionalConfiguration ( OptionalConfiguration(..) )
24 "List all remote forwards for mail accounts stored in a SQL database."
26 program_name :: String
27 program_name = "list-remote-forwards"
30 my_summary = program_name ++ "-" ++ (showVersion version)
32 database_help :: String
34 "The name of the database (or file, if SQLite) to which we should connect"
36 domain_query_help :: String
38 "SQL query used to produce the list of local domains"
40 exclude_mx_help :: String
42 "MX for whom we don't report remote forwards"
44 forward_query_help :: String
46 "SQL query used to produce the list of forwards, i.e. (to,from) pairs"
50 "Hostname where the database is located (postgres-only)"
52 password_help :: String
54 "Password used to connect to the database (postgres-only)"
58 "Port number used to connect to the database (postgres-only)"
60 username_help :: String
62 "Username used to connect to the database (postgres-only)"
64 arg_spec :: OptionalConfiguration
66 OptionalConfiguration {
67 database = def &= help database_help,
68 domain_query = def &= help domain_query_help,
69 exclude_mx = def &= help exclude_mx_help,
70 forward_query = def &= help forward_query_help,
71 host = def &= help host_help,
72 password = def &= help password_help,
73 port = def &= help port_help,
74 username = def &= help username_help }
75 &= program program_name
77 &= details [description]
79 get_args :: IO OptionalConfiguration
80 get_args = cmdArgs arg_spec