MCPcopy
hub / github.com/spf13/cobra / HasAlias

Method HasAlias

command.go:1551–1558  ·  view source on GitHub ↗

HasAlias determines if a given string is an alias of the command.

(s string)

Source from the content-addressed store, hash-verified

1549
1550// HasAlias determines if a given string is an alias of the command.
1551func (c *Command) HasAlias(s string) bool {
1552 for _, a := range c.Aliases {
1553 if commandNameMatches(a, s) {
1554 return true
1555 }
1556 }
1557 return false
1558}
1559
1560// CalledAs returns the command name or alias that was used to invoke
1561// this command or an empty string if the command has not been called.

Callers 2

findNextMethod · 0.80

Calls 1

commandNameMatchesFunction · 0.85

Tested by

no test coverage detected