--- a/netserver/Opts.hs Sun Jan 25 18:54:30 2009 +0000
+++ b/netserver/Opts.hs Sun Jan 25 18:54:39 2009 +0000
@@ -14,10 +14,11 @@
options :: [OptDescr (ServerInfo -> ServerInfo)]
options = [
Option ['p'] ["port"] (ReqArg readListenPort "PORT") "listen on PORT",
- Option ['d'] ["dedicated"] (ReqArg readDedicated "BOOL") "start as dedicated (True or False)"
+ Option ['d'] ["dedicated"] (ReqArg readDedicated "BOOL") "start as dedicated (True or False)",
+ Option [] ["password"] (ReqArg readPassword "STRING") "admin password"
]
-readListenPort, readDedicated :: String -> ServerInfo -> ServerInfo
+readListenPort, readDedicated, readPassword :: String -> ServerInfo -> ServerInfo
readListenPort str opts = opts{listenPort = readPort}
where
readPort = fromInteger $ fromMaybe 46631 (maybeRead str :: Maybe Integer)
@@ -26,6 +27,8 @@
where
readDedicated = fromMaybe True (maybeRead str :: Maybe Bool)
+readPassword str opts = opts{adminPassword = str}
+
getOpts :: ServerInfo -> IO ServerInfo
getOpts opts = do
args <- getArgs