Compare commits

1 Commits
Author SHA1 Message Date
clawbot 9b59378077 Read a path or URL named help or h as an argument (closes #198)
check / check (push) Waiting to run
On gen, check, freshen, fetch, list and export, a first argument of
`help` or `h` ran urfave/cli's built-in help command, so
`check help --require-signature FPR` printed help and passed. Those
commands now set urfave/cli's HideHelpCommand, which leaves out their
help command; the root keeps its own, so `mfer help` and
`mfer help check` still work. `check DIR --help` failed with
`No help topic for 'DIR'`; their CommandNotFound now prints the
command's own help, as `check --help` does.

Model: opus-5-5
2026-10-13 20:42:47 +00:00
+23 -18
View File
@@ -1860,28 +1860,33 @@ func TestCommandsReadHelpAsArgument(t *testing.T) {
}
}
// TestCheckHelpBesideArgument runs check with --help or -h before and after
// a directory, and runs help check. Each must print what check --help prints.
func TestCheckHelpBesideArgument(t *testing.T) {
// TestHelpBesideArgument runs each command that takes a path or URL with
// --help or -h before and after a directory, and runs help on that command.
// Each must print what the command's own --help prints.
func TestHelpBesideArgument(t *testing.T) {
t.Parallel()
want := testOpts([]string{testApp, cmdCheck, testFlagHelp}, afero.NewMemMapFs())
require.Equal(t, 0, runCLI(want))
require.Contains(t, testStdout(t, want), "Validate files using manifest file")
for _, args := range [][]string{
{cmdCheck, testDir, testFlagHelp},
{cmdCheck, testFlagHelp, testDir},
{cmdCheck, testDir, "-h"},
{testCmdHelp, cmdCheck},
for _, command := range []string{
cmdGenerate, cmdCheck, cmdFreshen, cmdList, cmdExport, cmdFetch,
} {
t.Run(strings.Join(args, " "), func(t *testing.T) {
t.Parallel()
want := testOpts([]string{testApp, command, testFlagHelp}, afero.NewMemMapFs())
require.Equal(t, 0, runCLI(want))
require.Contains(t, testStdout(t, want), testApp+" "+command)
opts := testOpts(slices.Concat([]string{testApp}, args), afero.NewMemMapFs())
assert.Equal(t, 0, runCLI(opts), testStderr(t, opts))
assert.Equal(t, testStdout(t, want), testStdout(t, opts))
})
for _, args := range [][]string{
{command, testDir, testFlagHelp},
{command, testFlagHelp, testDir},
{command, testDir, "-h"},
{testCmdHelp, command},
} {
t.Run(strings.Join(args, " "), func(t *testing.T) {
t.Parallel()
opts := testOpts(slices.Concat([]string{testApp}, args), afero.NewMemMapFs())
assert.Equal(t, 0, runCLI(opts), testStderr(t, opts))
assert.Equal(t, testStdout(t, want), testStdout(t, opts))
})
}
}
}