Skip to content
Myr

Delete name field from Command (#547)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Albert Nigmatzianov · committed by Eric Paris · parent 845c905 · Browse files · 1 file+5 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • Discussion: https://github.com/spf13/cobra/pull/422#discussion_r143918343

Diff stats

1 file+5 added−10 removed

  • other:+5 added−10 removed

1 file+5 added−10 removed

modified:command.go+5 added-10 removed
126 unmodified lines
127128 // TraverseChildren parses flags on all parents before executing child command.129 TraverseChildren bool130131 // name is the command name, usually the executable's name.132 name string131 // commands is the list of commands supported by this program.132 commands []*Command133 // parent is a parent command for this command.134 parent *Command
909 unmodified lines
1044}10451046// Name returns the command's name: the first word in the use line.1047func (c *Command) Name() string {1050 if c.name == "" {1051 name := c.Use1052 i := strings.Index(name, " ")1053 if i >= 0 {1054 name = name[:i]1048 name := c.Use1049 i := strings.Index(name, " ")1050 if i >= 0 {1051 name = name[:i]1055 }1056 c.name = name1052 }1058 return c.name1053 return name1054}10551056// HasAlias determines if a given string is an alias of the command.1057func (c *Command) HasAlias(s string) bool {
349 unmodified lines