MCPcopy Index your code
hub / github.com/docker/cli / getCommandName

Function getCommandName

cli/command/telemetry_utils.go:156–163  ·  view source on GitHub ↗

getCommandName gets the cobra command name in the format `... parentCommandName commandName` by traversing it's parent commands recursively. until the root command is reached. Note: The root command's name is excluded. If cmd is the root cmd, return ""

(cmd *cobra.Command)

Source from the content-addressed store, hash-verified

154//
155// Note: The root command's name is excluded. If cmd is the root cmd, return ""
156func getCommandName(cmd *cobra.Command) string {
157 fullCmdName := getFullCommandName(cmd)
158 _, after, ok := strings.Cut(fullCmdName, " ")
159 if !ok {
160 return ""
161 }
162 return after
163}
164
165// getFullCommandName gets the full cobra command name in the format
166// `... parentCommandName commandName` by traversing it's parent commands recursively

Callers 2

TestGetCommandNameFunction · 0.85
BaseCommandAttributesFunction · 0.85

Calls 1

getFullCommandNameFunction · 0.85

Tested by 1

TestGetCommandNameFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…