Read a path or URL named help or h as an argument (closes #198) #211

Merged
clawbot merged 1 commits from issue-198-help-is-a-path into next 2026-10-14 00:00:46 +02:00
Collaborator

Closes #198.

urfave/cli gives every command a built-in help subcommand with the alias h, and reads a first argument by either name as that subcommand. A path or URL named help or h given to gen, check, freshen, fetch, list or export therefore printed the command's help and exited 0, so check help --require-signature FPR checked nothing and passed.

Both settings used are urfave/cli's own:

  • HideHelpCommand on each of those six commands. urfave/cli then leaves out their help subcommand, and help and h are arguments like any other. It is set per command and not on the root, because urfave/cli applies it to the command that sets it and to every command below; on the root it would also remove mfer help.
  • CommandNotFound on the same six. With --help, urfave/cli reads the command's first argument as a help topic, so check DIR --help and check --help DIR failed with No help topic for 'DIR'. urfave/cli calls CommandNotFound when no topic matches, and it now prints the command's own help, the same text check --help prints. That function, showCommandHelp, is the only code of our own.

version is unchanged: it takes no argument.

Model: opus-5-5

Closes https://git.eeqj.de/sneak/mfer/issues/198. urfave/cli gives every command a built-in `help` subcommand with the alias `h`, and reads a first argument by either name as that subcommand. A path or URL named `help` or `h` given to `gen`, `check`, `freshen`, `fetch`, `list` or `export` therefore printed the command's help and exited 0, so `check help --require-signature FPR` checked nothing and passed. Both settings used are urfave/cli's own: - `HideHelpCommand` on each of those six commands. urfave/cli then leaves out their help subcommand, and `help` and `h` are arguments like any other. It is set per command and not on the root, because urfave/cli applies it to the command that sets it and to every command below; on the root it would also remove `mfer help`. - `CommandNotFound` on the same six. With `--help`, urfave/cli reads the command's first argument as a help topic, so `check DIR --help` and `check --help DIR` failed with `No help topic for 'DIR'`. urfave/cli calls `CommandNotFound` when no topic matches, and it now prints the command's own help, the same text `check --help` prints. That function, `showCommandHelp`, is the only code of our own. `version` is unchanged: it takes no argument. Model: opus-5-5
clawbot added the needs-review label 2026-10-13 20:08:03 +02:00
clawbot self-assigned this 2026-10-13 20:08:03 +02:00
Author
Collaborator

Review failed, one finding.

  • internal/cli/entry_test.go, TestCheckHelpBesideArgument: --help and -h next to an argument are tested on check only, but the change sets CommandNotFound: showCommandHelp on six commands. On gen, freshen, fetch, list and export that line can be dropped without a test failing, and No help topic for 'DIR' would come back on that command. Acceptable: run the DIR --help, --help DIR and DIR -h cases on each of the six commands, the way TestCommandsReadHelpAsArgument loops over them, and compare each with that command's own --help output.

Judgement call: version keeps urfave/cli's help command, so mfer version x --help still fails with No help topic for 'x'. I read #198 as covering only the six commands that take a path or URL, as the PR body says.

Model: opus-5-5

Review failed, one finding. - `internal/cli/entry_test.go`, `TestCheckHelpBesideArgument`: `--help` and `-h` next to an argument are tested on `check` only, but the change sets `CommandNotFound: showCommandHelp` on six commands. On `gen`, `freshen`, `fetch`, `list` and `export` that line can be dropped without a test failing, and `No help topic for 'DIR'` would come back on that command. Acceptable: run the `DIR --help`, `--help DIR` and `DIR -h` cases on each of the six commands, the way `TestCommandsReadHelpAsArgument` loops over them, and compare each with that command's own `--help` output. Judgement call: `version` keeps urfave/cli's help command, so `mfer version x --help` still fails with `No help topic for 'x'`. I read https://git.eeqj.de/sneak/mfer/issues/198 as covering only the six commands that take a path or URL, as the PR body says. Model: opus-5-5
clawbot added needs-rework and removed needs-review labels 2026-10-13 21:52:22 +02:00
clawbot added 1 commit 2026-10-13 22:42:50 +02:00
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
clawbot force-pushed issue-198-help-is-a-path from a4f5d375b5 to 9b59378077 2026-10-13 22:42:50 +02:00 Compare
Author
Collaborator
  • Review finding (help next to an argument tested on check only): TestCheckHelpBesideArgument is now TestHelpBesideArgument and runs DIR --help, --help DIR, DIR -h and help CMD on each of gen, check, freshen, fetch, list and export, comparing each with that command's own --help output. With CommandNotFound removed from gen and fetch, their cases fail with No help topic for '/testdir'.

Model: opus-5-5

- Review finding (help next to an argument tested on `check` only): `TestCheckHelpBesideArgument` is now `TestHelpBesideArgument` and runs `DIR --help`, `--help DIR`, `DIR -h` and `help CMD` on each of `gen`, `check`, `freshen`, `fetch`, `list` and `export`, comparing each with that command's own `--help` output. With `CommandNotFound` removed from `gen` and `fetch`, their cases fail with `No help topic for '/testdir'`. Model: opus-5-5
clawbot added needs-review and removed needs-rework labels 2026-10-13 22:42:59 +02:00
Author
Collaborator

Review passed.

Judgement call: version keeps urfave/cli's help command, so mfer version x --help still fails with No help topic for 'x'; I read #198 as covering only the six commands that take a path or URL.

Model: opus-5-5

Review passed. Judgement call: `version` keeps urfave/cli's help command, so `mfer version x --help` still fails with `No help topic for 'x'`; I read https://git.eeqj.de/sneak/mfer/issues/198 as covering only the six commands that take a path or URL. Model: opus-5-5
clawbot merged commit 7abe9a0ab1 into next 2026-10-14 00:00:46 +02:00
clawbot deleted branch issue-198-help-is-a-path 2026-10-14 00:00:46 +02:00
Sign in to join this conversation.