removed lua command, its useless, and 'lua ...' is what i need
2 files changed, 7 insertions(+), 47 deletions(-)

M cmd/hackurist/main.go
M hackurist.go
M cmd/hackurist/main.go +7 -31
@@ 13,12 13,10 @@ func usage() {
 	flag.PrintDefaults()
 }
 
-var address = flag.String("a", "127.0.0.1:5000", "dfhack rpc server address")
-var debug = flag.Bool("d", false, "print debug messages")
-
 func main() {
+	address := flag.String("a", "127.0.0.1:5000", "dfhack rpc server address")
+	debug := flag.Bool("d", false, "print debug messages")
 	help := flag.Bool("h", false, "help")
-	lua := flag.Bool("lua", false, "run lua command")
 
 	flag.Parse()
 	if *help {

          
@@ 29,12 27,8 @@ func main() {
 		usage()
 		os.Exit(2)
 	}
-	var err error
-	if *lua {
-		err = runCommand()
-	} else {
-		err = runLuaCommand()
-	}
+	cmd := flag.Arg(0)
+	err := run(*address, cmd, flag.Args()[1:], *debug)
 	if err != nil {
 		log.Println(err)
 		os.Exit(1)

          
@@ 42,8 36,8 @@ func main() {
 	os.Exit(0)
 }
 
-func runLuaCommand() error {
-	conn, err := hackurist.Dial(*address, *debug)
+func run(address, cmd string, args []string, debug bool) error {
+	conn, err := hackurist.Dial(address, debug)
 	if err != nil {
 		return err
 	}

          
@@ 52,28 46,10 @@ func runLuaCommand() error {
 	if err != nil {
 		return err
 	}
-	result, err := conn.RunLuaCommand(flag.Arg(0), flag.Arg(1), flag.Args()[2:])
+	result, err := conn.RunCommand(cmd, args)
 	fmt.Print(string(result))
 	if err != nil {
 		return err
 	}
 	return nil
 }
-
-func runCommand() error {
-	conn, err := hackurist.Dial(*address, *debug)
-	if err != nil {
-		return err
-	}
-	defer conn.Close()
-	err = conn.ShakeHands()
-	if err != nil {
-		return err
-	}
-	result, err := conn.RunCommand(flag.Arg(0), flag.Args()[1:])
-	fmt.Print(string(result))
-	if err != nil {
-		return err
-	}
-	return nil
-}

          
M hackurist.go +0 -16
@@ 202,22 202,6 @@ func (c Conn) RunCommand(cmd string, arg
 	return response, nil
 }
 
-// RunLuaCommand sends lua command to the server.
-// It reads the response, processes it and returns the output
-// ready for a text client.
-func (c Conn) RunLuaCommand(module, fn string, args []string) ([]byte, error) {
-	protoCmd, err := proto.Marshal(&dfproto.CoreRunLuaRequest{Module: &module,
-		Function: &fn, Arguments: args})
-	if err != nil {
-		return nil, fmt.Errorf("RunCommand: %s", err)
-	}
-	if err = c.write(protoCmd); err != nil {
-		return nil, fmt.Errorf("RunLuaCommand: %s", err)
-	}
-
-	return nil, nil
-}
-
 // todo: timeout
 func (c Conn) write(b []byte) error {
 	written, err := c.conn.Write(b)