fix: address review
This commit is contained in:
parent
9324b15e36
commit
aadcf413e5
2 changed files with 7 additions and 4 deletions
|
|
@ -27,12 +27,15 @@ func TestShowErrHint(t *testing.T) {
|
||||||
{"required flag(s) \"model\" not set", true},
|
{"required flag(s) \"model\" not set", true},
|
||||||
// Generic invalid-argument errors — should show hint
|
// Generic invalid-argument errors — should show hint
|
||||||
{"invalid argument \"abc\" for --count", true},
|
{"invalid argument \"abc\" for --count", true},
|
||||||
|
// required flag errors — should show hint
|
||||||
|
{"required flag(s) \"model\" not set", true},
|
||||||
// usage: in message — should show hint
|
// usage: in message — should show hint
|
||||||
{"bad input\nusage: picoclaw ...", true},
|
{"bad input\nusage: picoclaw ...", true},
|
||||||
// Should NOT false-positive on unrelated "flag" words
|
// Should NOT false-positive on broad words
|
||||||
{"connection flagged by remote", false},
|
{"connection flagged by remote", false},
|
||||||
{"feature flag not set", false},
|
{"feature flag not set", false},
|
||||||
{"please flag this issue", false},
|
{"invalid API key provided", false},
|
||||||
|
{"authentication required", false},
|
||||||
// Unrelated messages — no hint
|
// Unrelated messages — no hint
|
||||||
{"something went wrong", false},
|
{"something went wrong", false},
|
||||||
{"network timeout", false},
|
{"network timeout", false},
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ func showErrHint(msg string) bool {
|
||||||
return strings.Contains(m, "unknown flag") ||
|
return strings.Contains(m, "unknown flag") ||
|
||||||
strings.Contains(m, "unknown shorthand flag") ||
|
strings.Contains(m, "unknown shorthand flag") ||
|
||||||
strings.Contains(m, "flag needs an argument") ||
|
strings.Contains(m, "flag needs an argument") ||
|
||||||
strings.Contains(m, "invalid") ||
|
strings.Contains(m, "invalid argument") ||
|
||||||
strings.Contains(m, "required") ||
|
strings.Contains(m, "required flag") ||
|
||||||
strings.Contains(m, "usage:")
|
strings.Contains(m, "usage:")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue