This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
parseFlags :: [String] -> Options -> Maybe Options | |
parseFlags (flag : flags) opts = do | |
let pieces = splitOn "=" flag | |
case pieces of | |
"--port" : arg : _ -> parseFlags flags opts{ port = read arg } | |
"--domain-socket" : arg : _ -> parseFlags flags opts{ domainSocket = read arg } | |
"--host" : arg : _ -> parseFlags flags opts{ host = arg } | |
"--transport" : arg : _ -> parseFlags flags opts{ transport = arg } | |
"--protocol" : arg : _ -> parseFlags flags opts{ protocol = getProtocol arg } | |
"-n" : arg : _ -> parseFlags flags opts{ testLoops = read arg } |