telemetryCommandPath returns the path of the command that args resolve to when it is in refreshTelemetryCommands, and "other" for any other command, including extensions, aliases, and arguments that resolve to no command.
(rootCmd *cobra.Command, args []string)
| 293 | // telemetryCommandPath returns the path of the command that args resolve to when it is in refreshTelemetryCommands, |
| 294 | // and "other" for any other command, including extensions, aliases, and arguments that resolve to no command. |
| 295 | func telemetryCommandPath(rootCmd *cobra.Command, args []string) string { |
| 296 | c, _, err := rootCmd.Find(args) |
| 297 | if err == nil && c != nil && slices.Contains(refreshTelemetryCommands, c.CommandPath()) { |
| 298 | return c.CommandPath() |
| 299 | } |
| 300 | return "other" |
| 301 | } |
| 302 | |
| 303 | // printError writes err to out, followed by usage information when the error |
| 304 | // is the result of command misuse. When fullHelp is set the complete help text |