1 {-# LANGUAGE DeriveDataTypeable #-}
8 import System.Console.CmdArgs (
21 -- Get the version from Cabal.
22 import Paths_email_validator ( version )
23 import Data.Version ( showVersion )
26 -- We optionally accept input/output files to use instead of
28 data Args = Args { accept_a :: Bool,
29 input_file :: Maybe FilePath,
30 output_file :: Maybe FilePath,
32 deriving (Show, Data, Typeable)
35 description = "Perform naive validation of email addresses."
37 program_name :: String
38 program_name = "email-validator"
41 my_summary = program_name ++ "-" ++ (showVersion version)
43 accept_a_help :: String
45 "Accept an 'A' record for the domain instead of requiring an MX record."
47 input_file_help :: String
49 "Path to the input file (default: stdin), one email address per line"
51 output_file_help :: String
53 "Path to the output file (default: stdout)"
55 rfc5322_help :: String
57 "Validate according to RFC 5322 (incredibly lenient)."
61 Args { accept_a = def &= help accept_a_help,
62 input_file = def &= typFile &= help input_file_help,
63 output_file = def &= typFile &= help output_file_help,
64 rfc5322 = def &= help rfc5322_help }
65 &= program program_name
67 &= details [description]
72 get_args = cmdArgs arg_spec