1 {-# LANGUAGE DeriveDataTypeable #-}
8 import System.Console.CmdArgs (
20 -- Get the version from Cabal.
21 import Paths_email_validator ( version )
22 import Data.Version ( showVersion )
25 -- We optionally accept input/output files to use instead of
27 data Args = Args { accept_a :: Bool,
28 input_file :: Maybe FilePath,
29 output_file :: Maybe FilePath,
34 description = "Perform naive validation of email addresses."
36 program_name :: String
37 program_name = "email-validator"
40 my_summary = program_name ++ "-" ++ (showVersion version)
42 accept_a_help :: String
44 "Accept an 'A' record for the domain instead of requiring an MX record."
46 input_file_help :: String
48 "Path to the input file (default: stdin), one email address per line"
50 output_file_help :: String
52 "Path to the output file (default: stdout)"
54 rfc5322_help :: String
56 "Validate according to RFC 5322 (incredibly lenient)."
60 Args { accept_a = def &= help accept_a_help,
61 input_file = def &= typFile &= help input_file_help,
62 output_file = def &= typFile &= help output_file_help,
63 rfc5322 = def &= help rfc5322_help }
64 &= program program_name
66 &= details [description]
71 get_args = cmdArgs arg_spec