- -- The repetition here is necessary, some CmdArgs magic going on.
- ns :: Args
- ns = NS {
- no_append_root = def
- &= groupname "Common flags"
- &= help no_append_root_help,
-
- server = def
- &= groupname "Common flags"
- &= typ "IP"
- &= help server_help,
-
- delegates = def
- &= args
- &= typ "DELEGATES" }
-
- &= details [ns_description]
-
- mx :: Args
- mx = MX {
- no_append_root = def
- &= groupname "Common flags"
- &= help no_append_root_help,
-
- server = def
- &= groupname "Common flags"
- &= typ "IP"
- &= help server_help,
-
- delegates = def
- &= args
- &= typ "DELEGATES" }
-
- &= details [mx_description]
-
+ -- | Create a mode, adding all of the common flags to it
+ -- automatically. The big ugly type of the first argument is
+ -- simply the type of our NS/MX constructors.
+ --
+ make_mode :: (Bool -> Maybe String -> Timeout -> [String] -> Args)
+ -> String
+ -> (Annotate Ann)
+ make_mode ctor desc =
+ record (ctor def def def def) [
+ no_append_root := def
+ += groupname "Common flags"
+ += help no_append_root_help,
+
+ server := def
+ += groupname "Common flags"
+ += typ "IP"
+ += help server_help,
+
+ timeout := def
+ += groupname "Common flags"
+ += typ "SECONDS"
+ += help timeout_help,
+
+ delegates := def
+ += args
+ += typ "DELEGATES" ]
+ += details [" " ++ desc]
+
+
+ -- Here we just create the NS/MX modes using our make_mode from above.
+ ns = make_mode NS ns_description
+ mx = make_mode MX mx_description
+
+
+
+-- | This is the public interface; i.e. what 'main' should use to get
+-- the command-line arguments.
+--