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 (
20 OptionalConfiguration( OptionalConfiguration,
33 "List all remote forwards for mail accounts stored in a SQL database."
35 program_name :: String
36 program_name = "list-remote-forwards"
39 my_summary = program_name ++ "-" ++ (showVersion version)
41 database_help :: String
43 "The name of the database (or file, if SQLite) to which we should connect"
45 domain_query_help :: String
47 "SQL query used to produce the list of local domains"
49 exclude_mx_help :: String
51 "MX for whom we don't report remote forwards"
53 forward_query_help :: String
55 "SQL query used to produce the list of forwards, i.e. (to,from) pairs"
59 "Hostname where the database is located (postgres-only)"
61 password_help :: String
63 "Password used to connect to the database (postgres-only)"
67 "Port number used to connect to the database (postgres-only)"
69 username_help :: String
71 "Username used to connect to the database (postgres-only)"
73 arg_spec :: OptionalConfiguration
75 OptionalConfiguration {
76 database = def &= help database_help,
77 domain_query = def &= help domain_query_help,
78 exclude_mx = def &= help exclude_mx_help,
79 forward_query = def &= help forward_query_help,
80 host = def &= help host_help,
81 password = def &= help password_help,
82 port = def &= help port_help,
83 username = def &= help username_help }
84 &= program program_name
86 &= details [description]
88 get_args :: IO OptionalConfiguration
89 get_args = cmdArgs arg_spec