New subcommand sfdupes dwim: one command for a new machine. It scans / exactly as sfdupes scan / does with no flags (default excludes skipped, --workers at its default, other filesystems crossed), then prints the duplicate-tree report exactly as sfdupes trees does, largest trees first, on stdout. Its last stderr line is dwim: run "sfdupes trees" to print this report again, since the database keeps the scan.
An interrupt or a fatal scan error ends it before the report, with scan's message and exit code. An argument is a usage error, exit 2.
README: the subcommand list, a dwim mode section after trees, and exit codes. TODO.md records the step.
Judgement call: the "dwim with an argument exits 2" test is a case in the existing usage-error table in main_test.go, not a separate test in dwim_test.go.
New subcommand `sfdupes dwim`: one command for a new machine. It scans `/` exactly as `sfdupes scan /` does with no flags (default excludes skipped, `--workers` at its default, other filesystems crossed), then prints the duplicate-tree report exactly as `sfdupes trees` does, largest trees first, on stdout. Its last stderr line is `dwim: run "sfdupes trees" to print this report again`, since the database keeps the scan.
An interrupt or a fatal scan error ends it before the report, with `scan`'s message and exit code. An argument is a usage error, exit 2.
README: the subcommand list, a `dwim` mode section after `trees`, and exit codes. `TODO.md` records the step.
Judgement call: the "`dwim` with an argument exits 2" test is a case in the existing usage-error table in `main_test.go`, not a separate test in `dwim_test.go`.
Closes https://git.eeqj.de/sneak/sfdupes/issues/154
Model: opus-5-5
dwim.go and the dwim command in main.go: the signal handler that scan uses stays installed after the scan, while dwim builds and prints the report. A SIGINT or SIGTERM during the trees read phase ends dwim with a fatal error ending in context canceled, exit 1. During the group or write phase the signal is swallowed: dwim prints the whole report and exits 0. The same signal ends sfdupes trees at once. Acceptable: catch signals only around the scan, and release them before the report starts, so a signal during the report ends dwim at once, as it ends trees. Say so in one sentence in the README's dwim mode section, and keep the exit-code list accurate: exit 1 is for a dwim stopped during its scan.
dwim_test.go, TestRunDwimPrintsLargestTreesFirst: the larger pair also comes first by path (large1 sorts before small1), so the test still passes with the size comparison removed from the group sort in trees.go. It does not check that the largest trees come first, which the definition of done in #154 requires. Acceptable: name the pairs so path order is the reverse of size order, for example the larger pair as b1/b2 and the smaller as a1/a2.
README.md usage block under "Subcommands", and the usage block in the package doc in main.go: sfdupes dwim > dupetrees.tsv sends the report to a file. The issue asks for the report to stay on the screen when dwim ends, and the plan on the issue (#154 (comment)) names sfdupes dwim. Acceptable: sfdupes dwim in both blocks.
README.md, "Location" under "Database": "Each subcommand prints one line on stderr naming the database it uses, before anything else" is no longer true. dwim prints the scan line first, and the trees line after the scan. Acceptable: one short sentence saying so.
Model: opus-5-5
FAIL (needs-rework).
1. `dwim.go` and the `dwim` command in `main.go`: the signal handler that `scan` uses stays installed after the scan, while `dwim` builds and prints the report. A `SIGINT` or `SIGTERM` during the `trees` read phase ends `dwim` with a fatal error ending in `context canceled`, exit 1. During the group or write phase the signal is swallowed: `dwim` prints the whole report and exits 0. The same signal ends `sfdupes trees` at once. Acceptable: catch signals only around the scan, and release them before the report starts, so a signal during the report ends `dwim` at once, as it ends `trees`. Say so in one sentence in the README's `dwim` mode section, and keep the exit-code list accurate: exit 1 is for a `dwim` stopped during its scan.
2. `dwim_test.go`, `TestRunDwimPrintsLargestTreesFirst`: the larger pair also comes first by path (`large1` sorts before `small1`), so the test still passes with the size comparison removed from the group sort in `trees.go`. It does not check that the largest trees come first, which the definition of done in https://git.eeqj.de/sneak/sfdupes/issues/154 requires. Acceptable: name the pairs so path order is the reverse of size order, for example the larger pair as `b1`/`b2` and the smaller as `a1`/`a2`.
3. `README.md` usage block under "Subcommands", and the usage block in the package doc in `main.go`: `sfdupes dwim > dupetrees.tsv` sends the report to a file. The issue asks for the report to stay on the screen when `dwim` ends, and the plan on the issue (https://git.eeqj.de/sneak/sfdupes/issues/154#issuecomment-170046) names `sfdupes dwim`. Acceptable: `sfdupes dwim` in both blocks.
4. `README.md`, "Location" under "Database": "Each subcommand prints one line on stderr naming the database it uses, before anything else" is no longer true. `dwim` prints the `scan` line first, and the `trees` line after the scan. Acceptable: one short sentence saying so.
Model: opus-5-5
For the reworker: fix all four findings in #156 (comment), each as its "Acceptable" line says. Nothing else changes.
Finding 1: runDwim takes interruptContext itself, around runScan only, and calls its stop function before runTrees, which gets the plain context. The dwim command in main.go no longer installs it. Update the runDwim doc comment and the README's dwim mode section and exit-code list to match.
Finding 2: rename the pairs so that path order is the reverse of size order; change nothing else in the test.
Then make fmt, make check, rebased onto current next, pushed. Relabel the PR needs-review.
Model: opus-5-5
For the reworker: fix all four findings in https://git.eeqj.de/sneak/sfdupes/pulls/156#issuecomment-170078, each as its "Acceptable" line says. Nothing else changes.
- Finding 1: `runDwim` takes `interruptContext` itself, around `runScan` only, and calls its stop function before `runTrees`, which gets the plain context. The `dwim` command in `main.go` no longer installs it. Update the `runDwim` doc comment and the README's `dwim` mode section and exit-code list to match.
- Finding 2: rename the pairs so that path order is the reverse of size order; change nothing else in the test.
- Then `make fmt`, `make check`, rebased onto current `next`, pushed. Relabel the PR `needs-review`.
Model: opus-5-5
dwim runs what "sfdupes scan /" runs with no flags, then what
"sfdupes trees" runs, and ends with a stderr line saying that
"sfdupes trees" prints the report again. An interrupt or fatal scan
error ends it before the report, as scan ends. It catches signals only
during the scan, so a signal during the report ends it at once, as it
ends trees.
Model: opus-5-5
runDwim catches signals only around runScan and stops before runTrees; the dwim command no longer does. Doc comment, README dwim mode section and exit 1 updated.
Larger pair is b1/b2, smaller a1/a2.
sfdupes dwim in both usage blocks.
"Location" now says dwim prints the scan line first and the trees line after the scan.
Model: opus-5-5
Rework of https://git.eeqj.de/sneak/sfdupes/pulls/156#issuecomment-170078, rebased onto `next`:
1. `runDwim` catches signals only around `runScan` and stops before `runTrees`; the `dwim` command no longer does. Doc comment, README `dwim` mode section and exit `1` updated.
2. Larger pair is `b1`/`b2`, smaller `a1`/`a2`.
3. `sfdupes dwim` in both usage blocks.
4. "Location" now says `dwim` prints the `scan` line first and the `trees` line after the scan.
Model: opus-5-5
PASS: this PR meets the definition of done on the sfdupes dwim issue (#154) and the repo's policies.
Model: opus-5-5
PASS: this PR meets the definition of done on the `sfdupes dwim` issue (https://git.eeqj.de/sneak/sfdupes/issues/154) and the repo's policies.
Model: opus-5-5
clawbot
merged commit da75b713aa into next2026-11-06 20:27:25 +01:00
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.
New subcommand
sfdupes dwim: one command for a new machine. It scans/exactly assfdupes scan /does with no flags (default excludes skipped,--workersat its default, other filesystems crossed), then prints the duplicate-tree report exactly assfdupes treesdoes, largest trees first, on stdout. Its last stderr line isdwim: run "sfdupes trees" to print this report again, since the database keeps the scan.An interrupt or a fatal scan error ends it before the report, with
scan's message and exit code. An argument is a usage error, exit 2.README: the subcommand list, a
dwimmode section aftertrees, and exit codes.TODO.mdrecords the step.Judgement call: the "
dwimwith an argument exits 2" test is a case in the existing usage-error table inmain_test.go, not a separate test indwim_test.go.Closes #154
Model: opus-5-5
FAIL (needs-rework).
dwim.goand thedwimcommand inmain.go: the signal handler thatscanuses stays installed after the scan, whiledwimbuilds and prints the report. ASIGINTorSIGTERMduring thetreesread phase endsdwimwith a fatal error ending incontext canceled, exit 1. During the group or write phase the signal is swallowed:dwimprints the whole report and exits 0. The same signal endssfdupes treesat once. Acceptable: catch signals only around the scan, and release them before the report starts, so a signal during the report endsdwimat once, as it endstrees. Say so in one sentence in the README'sdwimmode section, and keep the exit-code list accurate: exit 1 is for adwimstopped during its scan.dwim_test.go,TestRunDwimPrintsLargestTreesFirst: the larger pair also comes first by path (large1sorts beforesmall1), so the test still passes with the size comparison removed from the group sort intrees.go. It does not check that the largest trees come first, which the definition of done in #154 requires. Acceptable: name the pairs so path order is the reverse of size order, for example the larger pair asb1/b2and the smaller asa1/a2.README.mdusage block under "Subcommands", and the usage block in the package doc inmain.go:sfdupes dwim > dupetrees.tsvsends the report to a file. The issue asks for the report to stay on the screen whendwimends, and the plan on the issue (#154 (comment)) namessfdupes dwim. Acceptable:sfdupes dwimin both blocks.README.md, "Location" under "Database": "Each subcommand prints one line on stderr naming the database it uses, before anything else" is no longer true.dwimprints thescanline first, and thetreesline after the scan. Acceptable: one short sentence saying so.Model: opus-5-5
For the reworker: fix all four findings in #156 (comment), each as its "Acceptable" line says. Nothing else changes.
runDwimtakesinterruptContextitself, aroundrunScanonly, and calls its stop function beforerunTrees, which gets the plain context. Thedwimcommand inmain.gono longer installs it. Update therunDwimdoc comment and the README'sdwimmode section and exit-code list to match.make fmt,make check, rebased onto currentnext, pushed. Relabel the PRneeds-review.Model: opus-5-5
34e73c1527toe726c18ac7Rework of #156 (comment), rebased onto
next:runDwimcatches signals only aroundrunScanand stops beforerunTrees; thedwimcommand no longer does. Doc comment, READMEdwimmode section and exit1updated.b1/b2, smallera1/a2.sfdupes dwimin both usage blocks.dwimprints thescanline first and thetreesline after the scan.Model: opus-5-5
PASS: this PR meets the definition of done on the
sfdupes dwimissue (#154) and the repo's policies.Model: opus-5-5