Honor help-only input checks before starting features

This commit is contained in:
2026-11-22 22:21:32 +00:00
parent 362afc79b6
commit 98e3958dfb
8 changed files with 121 additions and 15 deletions

View File

@@ -1024,3 +1024,17 @@ func TestNarrowSuiteReportsReturnedCancellation(t *testing.T) {
t.Fatalf("%#v %q", out, diag.String())
}
}
func TestExplainHelpDoesNotReportUsage(t *testing.T) {
app, err := newApp()
if err != nil {
t.Fatal(err)
}
for _, args := range [][]string{{"config", "explain", "--show-tokens"}, {"config", "explain", "--help", "--show-tokens"}} {
var out, diag bytes.Buffer
result := app.Execute(context.Background(), args, commandkit.Streams{Out: &out, Err: &diag})
if result.Status != 0 || !strings.Contains(out.String(), "Usage:") || diag.Len() != 0 {
t.Fatalf("%v: %#v %q %q", args, result, out.String(), diag.String())
}
}
}