hasNameOrAliasPrefix returns true if the Name or any of aliases start with prefix
(prefix string)
| 1569 | // hasNameOrAliasPrefix returns true if the Name or any of aliases start |
| 1570 | // with prefix |
| 1571 | func (c *Command) hasNameOrAliasPrefix(prefix string) bool { |
| 1572 | if strings.HasPrefix(c.Name(), prefix) { |
| 1573 | c.commandCalledAs.name = c.Name() |
| 1574 | return true |
| 1575 | } |
| 1576 | for _, alias := range c.Aliases { |
| 1577 | if strings.HasPrefix(alias, prefix) { |
| 1578 | c.commandCalledAs.name = alias |
| 1579 | return true |
| 1580 | } |
| 1581 | } |
| 1582 | return false |
| 1583 | } |
| 1584 | |
| 1585 | // NameAndAliases returns a list of the command name and all aliases |
| 1586 | func (c *Command) NameAndAliases() string { |