X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=0ea89a0173c56456162c10ab882dc1dc35e84341;hp=42fcd616a4766ce4950063783ed492d2282663fa;hb=7cc26ab4bfa90c4abe0c741d5a3eaf575544466a;hpb=e8fe3d4c76b719d256a3c04d462819cd98218111 diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 42fcd61..0ea89a0 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -30,11 +30,13 @@ import System.Console.CmdArgs ( import Paths_haeredes (version) import Data.Version (showVersion) +-- | Description of the 'NS' mode. ns_description :: String ns_description = "Confirm delegation of NS records. " ++ "This is the default mode." +-- | Description of the 'MX' mode. mx_description :: String mx_description = "Confirm delegation of MX records." @@ -44,14 +46,26 @@ program_name = "haeredes" my_summary :: String my_summary = program_name ++ "-" ++ (showVersion version) +no_append_root_help :: String +no_append_root_help = + "Don't append a trailing dot to DNS names." + +-- | Help string for the --server flag. server_help :: String server_help = - "IP address of server to query " ++ - "(will use resolv.conf if not specified)" + "IP address or hostname of server to query " ++ + "(will use resolv.conf if not specified)." +-- | The Args type represents the possible command-line options. The +-- duplication here seems necessary; CmdArgs' magic requires us to +-- define some things explicitly. data Args = - NS { server :: Maybe String, delegates :: [String] } | - MX { server :: Maybe String, delegates :: [String] } + NS { no_append_root :: Bool, + server :: Maybe String, + delegates :: [String] } | + MX { no_append_root :: Bool, + server :: Maybe String, + delegates :: [String] } deriving (Data, Show, Typeable) arg_spec :: Args @@ -68,10 +82,13 @@ arg_spec = name "v", groupname "Common flags"] where - -- The repetition here is necessary, some Template Haskell magic - -- going on. + -- 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" @@ -85,6 +102,10 @@ arg_spec = mx :: Args mx = MX { + no_append_root = def + &= groupname "Common flags" + &= help no_append_root_help, + server = def &= groupname "Common flags" &= typ "IP"