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

Method CalledAs

command.go:1562–1567  ·  view source on GitHub ↗

CalledAs returns the command name or alias that was used to invoke this command or an empty string if the command has not been called.

()

Source from the content-addressed store, hash-verified

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.
1562func (c *Command) CalledAs() string {
1563 if c.commandCalledAs.called {
1564 return c.commandCalledAs.name
1565 }
1566 return ""
1567}
1568
1569// hasNameOrAliasPrefix returns true if the Name or any of aliases start
1570// with prefix

Callers 2

testMethod · 0.95
initCompleteCmdMethod · 0.80

Calls

no outgoing calls

Tested by 1

testMethod · 0.76