X-Git-Url: http://gitweb.michael.orlitzky.com/?p=haeredes.git;a=blobdiff_plain;f=src%2FCommandLine.hs;h=b94e378e516517e5c9d116fae5fe6979876b509e;hp=2118f5911ec2c533128f5a5c41530348ca10c362;hb=f9610a6d357f2ed79f2f18baa477244970f8b40f;hpb=95bd7958d5a3483ba2cbe232765138a7785b2429 diff --git a/src/CommandLine.hs b/src/CommandLine.hs index 2118f59..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 = @@ -56,15 +58,24 @@ server_help = "IP address or hostname of server to query " ++ "(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 -- define some things explicitly. 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) @@ -94,6 +105,11 @@ arg_spec = &= 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" }