mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-11 18:16:24 +05:00
Adding generic return to commands
This commit is contained in:
@@ -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() )
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user