Adding generic return to commands

This commit is contained in:
DanB
2012-09-12 18:19:51 +02:00
parent 9d2d8507fe
commit 4c5dbd3f67
2 changed files with 6 additions and 7 deletions

View File

@@ -25,7 +25,7 @@ import (
"net/rpc"
"net/rpc/jsonrpc"
"os"
//"reflect"
"reflect"
"timespans"
"console"
)
@@ -60,12 +60,11 @@ func main() {
if cmdErr != nil {
log.Fatal( cmdErr )
}
//res := reflect.ValueOf(cmd.RpcResult()).Elem()
var res string
if rpcErr := client.Call(cmd.RpcMethod(), cmd.RpcParams(), &res); rpcErr != nil {
res := cmd.RpcResult()
if rpcErr := client.Call(cmd.RpcMethod(), cmd.RpcParams(), res); rpcErr != nil {
log.Fatal( err )
}
fmt.Println( res )
fmt.Println( reflect.ValueOf(res).Elem().String() )
}

View File

@@ -8,7 +8,6 @@ import (
)
// Console Command interface
type Commander interface {
FromArgs(args []string) error // Load data from os arguments or flag.Args()
@@ -57,4 +56,5 @@ func GetCommandValue( args []string ) ( Commander, error ) {
}
return cmdVal, nil
}