--- /dev/null
+module CommandLine ( get_args )
+where
+
+import System.Console.CmdArgs (
+ (&=),
+ args,
+ cmdArgs,
+ def,
+ details,
+ help,
+ program,
+ summary,
+ typ )
+
+-- This let's us get the version from Cabal.
+import Paths_harbl ( version )
+import Data.Version ( showVersion )
+
+import Hosts ()
+import Lists ()
+import OptionalConfiguration ( OptionalConfiguration(..) )
+
+-- | The description of the program, displayed as part of the help.
+description :: String
+description = "Perform black- and white-list lookups on hosts."
+
+
+-- | The name of this program.
+program_name :: String
+program_name = "harbl"
+
+
+-- | A summary string output as part of the help.
+my_summary :: String
+my_summary = program_name ++ "-" ++ (showVersion version)
+
+
+-- | A description of the "daemonize" option.
+lists_help :: String
+lists_help =
+ "A list of RBLs to check. See the manual for advanced syntax."
+
+
+-- | A data structure representing the possible command-line
+-- options. The CmdArgs library is doing heavy magic beneath the
+-- hood here.
+--
+arg_spec :: OptionalConfiguration
+arg_spec =
+ OptionalConfiguration {
+ hosts = def &= typ "HOSTS" &= args,
+ lists = def &= typ "RBLs" &= help lists_help }
+ &= program program_name
+ &= summary my_summary
+ &= details [description]
+
+
+-- | A convenience function; our only export. Meant to be used in
+-- 'main' to retrieve the command-line arguments.
+--
+get_args :: IO OptionalConfiguration
+get_args = cmdArgs arg_spec