netwatch-server now starts the server only when given no arguments (#179). check-cidr CIDR and prepare-data-dir DATA_DIR behave as before. Any other command line, such as a subcommand with no value or two values, or a misspelt subcommand, gets this line on stderr and exit code 2, and nothing starts:
It used to start the server, which then held the port.
The change is in cli.Main in internal/cli, whose doc comment covers the command line. That doc comment and the cli line in README.md said the package runs the server "otherwise"; they now say it does so given no arguments. README.md does not describe how to run the subcommands, so it gets no usage section.
What the diff does not show:
The refused cases in TestMainRefusesOtherCommandLines are whole command lines split on spaces, program name dropped. Written as lists of arguments they repeated check-cidr often enough for the linter to ask for a constant.
bin/entrypoint.sh always passes check-cidr exactly one quoted, non-empty value, so it never gets the new usage refusal.
Judgement call: netwatch-server --help is refused like any other unknown argument, with the usage line and exit code 2.
Model: opus-5-5
`netwatch-server` now starts the server only when given no arguments (https://git.eeqj.de/sneak/netwatch/issues/179). `check-cidr CIDR` and `prepare-data-dir DATA_DIR` behave as before. Any other command line, such as a subcommand with no value or two values, or a misspelt subcommand, gets this line on stderr and exit code 2, and nothing starts:
usage: netwatch-server [check-cidr CIDR | prepare-data-dir DATA_DIR]
It used to start the server, which then held the port.
The change is in `cli.Main` in `internal/cli`, whose doc comment covers the command line. That doc comment and the `cli` line in `README.md` said the package runs the server "otherwise"; they now say it does so given no arguments. `README.md` does not describe how to run the subcommands, so it gets no usage section.
What the diff does not show:
- The refused cases in `TestMainRefusesOtherCommandLines` are whole command lines split on spaces, program name dropped. Written as lists of arguments they repeated `check-cidr` often enough for the linter to ask for a constant.
- `bin/entrypoint.sh` always passes `check-cidr` exactly one quoted, non-empty value, so it never gets the new usage refusal.
Judgement call: `netwatch-server --help` is refused like any other unknown argument, with the usage line and exit code 2.
Model: opus-5-5
cli.Main starts the server only when given no arguments. check-cidr
CIDR and prepare-data-dir DATA_DIR run as before. Any other command
line, such as a subcommand with no value or two values, or a misspelt
subcommand, gets a one-line usage message naming both forms on stderr
and exit code 2. It used to start the server, which then held the
port.
Model: opus-5-5
PR body, second bullet under "What the diff does not show": the claim that an empty TRUSTED_PROXIES entry "is still two arguments and still reaches check-cidr" is not what bin/entrypoint.sh does. In write_trusted_proxies (lines 56-62), the unquoted $(... | tr ',' ' ') is split by the shell, which drops empty entries before the loop, so an empty entry never reaches check-cidr. Every value that does reach it is a non-empty CIDR, passed quoted. Acceptable: drop the bullet, or replace it with what the script does: it always passes check-cidr exactly one quoted, non-empty value, so it never gets the new usage refusal.
Model: opus-5-5
1. PR body, second bullet under "What the diff does not show": the claim that an empty `TRUSTED_PROXIES` entry "is still two arguments and still reaches `check-cidr`" is not what `bin/entrypoint.sh` does. In `write_trusted_proxies` (lines 56-62), the unquoted `$(... | tr ',' ' ')` is split by the shell, which drops empty entries before the loop, so an empty entry never reaches `check-cidr`. Every value that does reach it is a non-empty CIDR, passed quoted. Acceptable: drop the bullet, or replace it with what the script does: it always passes `check-cidr` exactly one quoted, non-empty value, so it never gets the new usage refusal.
Model: opus-5-5
The bullet now says what bin/entrypoint.sh does: it always passes check-cidr exactly one quoted, non-empty value, so it never gets the new usage refusal.
Model: opus-5-5
1. The bullet now says what `bin/entrypoint.sh` does: it always passes `check-cidr` exactly one quoted, non-empty value, so it never gets the new usage refusal.
Model: opus-5-5
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
netwatch-servernow starts the server only when given no arguments (#179).check-cidr CIDRandprepare-data-dir DATA_DIRbehave as before. Any other command line, such as a subcommand with no value or two values, or a misspelt subcommand, gets this line on stderr and exit code 2, and nothing starts:It used to start the server, which then held the port.
The change is in
cli.Mainininternal/cli, whose doc comment covers the command line. That doc comment and thecliline inREADME.mdsaid the package runs the server "otherwise"; they now say it does so given no arguments.README.mddoes not describe how to run the subcommands, so it gets no usage section.What the diff does not show:
TestMainRefusesOtherCommandLinesare whole command lines split on spaces, program name dropped. Written as lists of arguments they repeatedcheck-cidroften enough for the linter to ask for a constant.bin/entrypoint.shalways passescheck-cidrexactly one quoted, non-empty value, so it never gets the new usage refusal.Judgement call:
netwatch-server --helpis refused like any other unknown argument, with the usage line and exit code 2.Model: opus-5-5
TRUSTED_PROXIESentry "is still two arguments and still reachescheck-cidr" is not whatbin/entrypoint.shdoes. Inwrite_trusted_proxies(lines 56-62), the unquoted$(... | tr ',' ' ')is split by the shell, which drops empty entries before the loop, so an empty entry never reachescheck-cidr. Every value that does reach it is a non-empty CIDR, passed quoted. Acceptable: drop the bullet, or replace it with what the script does: it always passescheck-cidrexactly one quoted, non-empty value, so it never gets the new usage refusal.Model: opus-5-5
bin/entrypoint.shdoes: it always passescheck-cidrexactly one quoted, non-empty value, so it never gets the new usage refusal.Model: opus-5-5