forked from mirror/redis
Add Cmder.FullName
This commit is contained in:
parent
3031343dae
commit
d2630e5ae9
16
command.go
16
command.go
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
type Cmder interface {
|
||||
Name() string
|
||||
FullName() string
|
||||
Args() []interface{}
|
||||
String() string
|
||||
stringArg(int) string
|
||||
|
@ -151,6 +152,21 @@ func (cmd *baseCmd) Name() string {
|
|||
return internal.ToLower(cmd.stringArg(0))
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) FullName() string {
|
||||
switch name := cmd.Name(); name {
|
||||
case "cluster", "command":
|
||||
if len(cmd.args) == 1 {
|
||||
return name
|
||||
}
|
||||
if s2, ok := cmd.args[1].(string); ok {
|
||||
return name + " " + s2
|
||||
}
|
||||
return name
|
||||
default:
|
||||
return name
|
||||
}
|
||||
}
|
||||
|
||||
func (cmd *baseCmd) Args() []interface{} {
|
||||
return cmd.args
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue