isCobraUsageError reports whether err is a cobra / pflag usage mistake, identified by the stable error text of the pinned cobra version.
(err error)
| 324 | // isCobraUsageError reports whether err is a cobra / pflag usage mistake, |
| 325 | // identified by the stable error text of the pinned cobra version. |
| 326 | func isCobraUsageError(err error) bool { |
| 327 | msg := err.Error() |
| 328 | for _, m := range cobraUsageErrorMarkers { |
| 329 | if strings.Contains(msg, m) { |
| 330 | return true |
| 331 | } |
| 332 | } |
| 333 | return false |
| 334 | } |
| 335 | |
| 336 | // installUnknownSubcommandGuard replaces cobra's silent help fallback on |
| 337 | // group commands (no Run/RunE) with an unknown_subcommand error. |
no test coverage detected