XXX: this is a hack to detect usage errors. See: https://github.com/spf13/cobra/pull/2266
(err error)
| 134 | // XXX: this is a hack to detect usage errors. |
| 135 | // See: https://github.com/spf13/cobra/pull/2266 |
| 136 | func isUsageError(err error) bool { |
| 137 | s := err.Error() |
| 138 | for _, prefix := range []string{ |
| 139 | "flag needs an argument:", |
| 140 | "unknown flag:", |
| 141 | "unknown shorthand flag:", |
| 142 | "unknown command", |
| 143 | "invalid argument", |
| 144 | } { |
| 145 | if strings.HasPrefix(s, prefix) { |
| 146 | return true |
| 147 | } |
| 148 | } |
| 149 | return false |
| 150 | } |
| 151 | |
| 152 | func writeLongShort(w *colorprofile.Writer, styles Styles, longShort string) { |
| 153 | if longShort == "" { |
no outgoing calls
searching dependent graphs…