Skip to content

Commit b923c41

Browse files
author
myxy99
committed
xflag
1 parent d8acb84 commit b923c41

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

xflag/xflag.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,12 @@ func Register(fs ...CommandNode) {
4848

4949
func RegisterSpecify(cnd *CommandNode, fs ...CommandNode) {
5050
for _, c := range fs {
51-
c.Flags(c.Command)
51+
if c.Command == nil || c.Name == "" {
52+
panic("command node name or comment is not nil ")
53+
}
54+
if c.Flags != nil {
55+
c.Flags(c.Command)
56+
}
5257
cnd.Command.AddCommand(c.Command)
5358
bucket.instances.Store(c.Name, c.Command)
5459
}

0 commit comments

Comments
 (0)