Permalink
Browse files

clean up the console a bit and remove tabs.

  • Loading branch information...
1 parent 746287c commit 1ba64427a55486f72950213fb8dbe7e9519935d9 Robey Pointer committed Apr 2, 2012
@@ -1,6 +1,11 @@
import com.twitter.sbt._
-seq((Project.defaultSettings ++ StandardProject.newSettings ++ SubversionPublisher.newSettings ++ CompileThriftScrooge.newSettings): _*)
+seq((
+ Project.defaultSettings ++
+ StandardProject.newSettings ++
+ SubversionPublisher.newSettings ++
+ CompileThriftScrooge.newSettings
+): _*)
organization := "com.twitter"
@@ -21,4 +26,3 @@ libraryDependencies ++= Seq(
mainClass in (Compile, run) := Some("com.twitter.birdname.Main")
mainClass in (Compile, packageBin) := Some("com.twitter.birdname.Main")
-
@@ -1,8 +1,8 @@
#!/bin/bash
if [ $# -lt 2 ] ; then
- echo "usage: console host port"
+ echo "usage: console <host> <port>"
exit 0
fi
-sbt "run-main com.twitter.birdname.BirdNameConsoleClient $1 $2"
+sbt "run-main com.twitter.birdname.BirdNameConsoleClient $1 $2"
@@ -1,46 +1,42 @@
package com.twitter.birdname
+import com.twitter.conversions.time._
import com.twitter.finagle.builder.ClientBuilder
import com.twitter.finagle.thrift.ThriftClientFramedCodec
import java.net.InetSocketAddress
-
-import com.twitter.conversions.time._
-
import scala.tools.nsc.interpreter._
-import scala.tools.nsc.interpreter.{JLineReader,JLineCompletion,ILoop,NamedParam}
import scala.tools.nsc.Settings
object BirdNameConsoleClient extends App {
-
- val service = ClientBuilder()
- .hosts(new InetSocketAddress(args(0),args(1).toInt))
- .codec(ThriftClientFramedCodec())
+ val service = ClientBuilder()
+ .hosts(new InetSocketAddress(args(0), args(1).toInt))
+ .codec(ThriftClientFramedCodec())
.hostConnectionLimit(1)
- .tcpConnectTimeout(3.seconds)
+ .tcpConnectTimeout(3.seconds)
.build()
-
- val client = new BirdNameService.FinagledClient(service)
-
- val intLoop = new ILoop
-
- Console.println("'client' has been binded. With it you can query different thrift methods your service exposes.")
- intLoop.setPrompt("\nfinagle-client> ")
-
- intLoop.settings = {
- val s = new Settings(Console.println)
- s.embeddedDefaults[BirdNameService.FinagledClient]
- s.Yreplsync.value = true
- s
- }
-
- intLoop.createInterpreter()
- intLoop.in = new JLineReader(new JLineCompletion(intLoop))
-
- intLoop.intp.beQuietDuring {
- intLoop.intp.interpret("""def exit = println("Type :quit to resume program execution.")""")
- intLoop.intp.bind(NamedParam("client",client))
- }
-
- intLoop.loop
- intLoop.closeInterpreter
-}
+
+ val client = new BirdNameService.FinagledClient(service)
+
+ val intLoop = new ILoop()
+
+ Console.println("'client' is bound to your thrift client.")
+ intLoop.setPrompt("\nfinagle-client> ")
+
+ intLoop.settings = {
+ val s = new Settings(Console.println)
+ s.embeddedDefaults[BirdNameService.FinagledClient]
+ s.Yreplsync.value = true
+ s
+ }
+
+ intLoop.createInterpreter()
+ intLoop.in = new JLineReader(new JLineCompletion(intLoop))
+
+ intLoop.intp.beQuietDuring {
+ intLoop.intp.interpret("""def exit = println("Type :quit to resume program execution.")""")
+ intLoop.intp.bind(NamedParam("client", client))
+ }
+
+ intLoop.loop()
+ intLoop.closeInterpreter()
+}

0 comments on commit 1ba6442

Please sign in to comment.