X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=b94e378e516517e5c9d116fae5fe6979876b509e;hp=0ea89a0173c56456162c10ab882dc1dc35e84341;hb=f9610a6d357f2ed79f2f18baa477244970f8b40f;hpb=7cc26ab4bfa90c4abe0c741d5a3eaf575544466a diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 0ea89a0..b94e378 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -30,6 +30,8 @@ import System.Console.CmdArgs ( import Paths_haeredes (version) import Data.Version (showVersion) +import Timeout (Timeout(..)) + -- | Description of the 'NS' mode. ns_description :: String ns_description = @@ -48,13 +50,20 @@ my_summary = program_name ++ "-" ++ (showVersion version) no_append_root_help :: String no_append_root_help = - "Don't append a trailing dot to DNS names." + "Don't append a trailing dot to DNS names" -- | Help string for the --server flag. server_help :: String server_help = "IP address or hostname of server to query " ++ - "(will use resolv.conf if not specified)." + "(will use resolv.conf if not specified)" + +-- | Help string for the --timeout flag. +timeout_help :: String +timeout_help = + "Query timeout, in seconds (default: " ++ defstr ++ ")" + where + defstr = show $ seconds (def :: Timeout) -- | The Args type represents the possible command-line options. The -- duplication here seems necessary; CmdArgs' magic requires us to @@ -62,9 +71,11 @@ server_help = data Args = NS { no_append_root :: Bool, server :: Maybe String, + timeout :: Timeout, delegates :: [String] } | MX { no_append_root :: Bool, server :: Maybe String, + timeout :: Timeout, delegates :: [String] } deriving (Data, Show, Typeable) @@ -91,9 +102,14 @@ arg_spec = server = def &= groupname "Common flags" - &= typ "IP" + &= typ "HOST" &= help server_help, + timeout = def + &= groupname "Common flags" + &= typ "SECONDS" + &= help timeout_help, + delegates = def &= args &= typ "DELEGATES" } @@ -111,6 +127,11 @@ arg_spec = &= typ "IP" &= help server_help, + timeout = def + &= groupname "Common flags" + &= typ "SECONDS" + &= help timeout_help, + delegates = def &= args &= typ "DELEGATES" }