package perftest

import perftest.client.Client
import perftest.server.Server

import java.net.URL

object Perftest {
  private def usage = println("Usage: Perftest [client|server] URL")
  private def parse(args: Array[String]) = if (args.length > 1) Some(args(0), new URL(args(1))) else None
  def main(args: Array[String]) = parse(args) match {
    case Some(("server", url)) => Server.run(url)
    case Some(("client", url)) => Client.run(Array(url.toString))
    case None                  => usage
  }
}

package perftest

import perftest.client.Client
import perftest.server.Server

import java.net.URL

object Perftest {
  private def usage = println("Usage: Perftest [client|server] URL")
  private def parse(args: Array[String]) = if (args.length > 1) Some(args(0), new URL(args(1))) else None
  def main(args: Array[String]) = parse(args) match {
    case Some(("server", url)) => Server.run(url)
    case Some(("client", url)) => Client.run(url)
    case None                  => usage
  }
}

Remove duplication of new URL(...) by parsing the 2nd arg as an URL
perftest: Remove duplication of new URL(...) by parsing the 2nd arg as an URL

Signed-off-by: Karim Osman <94396faf6cc817be76165477038b3cfa832e89a4@reaktor.fi>
Acked-by: Harri Salokorpi <eefb23b8deb8c30dca252cd0ae751b67337dc69f@reaktor.fi>
