Created
May 2, 2011 19:37
-
-
Save seanparsons/952216 to your computer and use it in GitHub Desktop.
Use of the command line parser.
This file contains hidden or 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
object Server { | |
def main(args: Array[String]): Unit = { | |
val serviceName = "appserver" | |
val managerPortOption = new CommandLineOption("Manager Port", "Manager Port", "managerPort") | |
val serverPortOption = new CommandLineOption("Server Port", "Server Port", "serverPort") | |
val options = List(managerPortOption, serverPortOption) | |
val arguments = List(new CommandLineArgument("Command", "Command")) | |
def success(options: Map[String, String], arguments: Seq[String]): Unit = { | |
val serverPort = options(serverPortOption.optionName).toInt | |
val managerPort = options(managerPortOption.optionName).toInt | |
remote.start("localhost", serverPort) // Start the server | |
remote.register(serviceName, actorOf(new ServerActor(managerPort))) | |
} | |
CommandLineParser.run(args, options, arguments, success) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment