X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=src%2FCommandLine.hs;h=1a1c313d3cb612ff6ccf58ca74d21de4221dcd31;hb=96d26b3fef724b2e48c42daf0179174463963cdf;hp=b489c7eb686670f7bfa7d515be99d3ff509513dc;hpb=03fd57187f32ac5f0e6a1590d42afcae738fddb2;p=haeredes.git diff --git a/src/CommandLine.hs b/src/CommandLine.hs index b489c7e..1a1c313 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -2,8 +2,7 @@ module CommandLine ( Args(..), - get_args - ) + get_args ) where import System.Console.CmdArgs ( @@ -30,6 +29,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 +57,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) @@ -91,9 +101,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 +126,11 @@ arg_spec = &= typ "IP" &= help server_help, + timeout = def + &= groupname "Common flags" + &= typ "SECONDS" + &= help timeout_help, + delegates = def &= args &= typ "DELEGATES" }