提交 92528ba7 作者: Juan Batiz-Benet

Sub -> Subcommand

上级 84fa7bc4
...@@ -33,7 +33,7 @@ func parsePath(input []string, root *commands.Command) ([]string, []string, erro ...@@ -33,7 +33,7 @@ func parsePath(input []string, root *commands.Command) ([]string, []string, erro
break break
} }
cmd := cmd.Sub(blob) cmd := cmd.Subcommand(blob)
if cmd == nil { if cmd == nil {
break break
} }
......
...@@ -82,7 +82,7 @@ func (c *Command) Resolve(path []string) ([]*Command, error) { ...@@ -82,7 +82,7 @@ func (c *Command) Resolve(path []string) ([]*Command, error) {
cmd := c cmd := c
for i, name := range path { for i, name := range path {
cmd = cmd.Sub(name) cmd = cmd.Subcommand(name)
if cmd == nil { if cmd == nil {
pathS := strings.Join(path[0:i], "/") pathS := strings.Join(path[0:i], "/")
...@@ -128,8 +128,8 @@ func (c *Command) GetOptions(path []string) (map[string]Option, error) { ...@@ -128,8 +128,8 @@ func (c *Command) GetOptions(path []string) (map[string]Option, error) {
return optionsMap, nil return optionsMap, nil
} }
// Sub returns the subcommand with the given id // Subcommand returns the subcommand with the given id
func (c *Command) Sub(id string) *Command { func (c *Command) Subcommand(id string) *Command {
return c.subcommands[id] return c.subcommands[id]
} }
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论