dwim: take the scan flags (closes #162) #193

Merged
clawbot merged 1 commits from issue-162-dwim-scan-flags into next 2026-11-11 08:37:19 +01:00
Collaborator

dwim now takes --workers, -x, --no-default-excludes and --exclude, with the meaning they have for scan.

  • The flags are shared, not copied: a scanOptions struct, addScanFlags and the check PreRunE serve both commands. runScan takes the struct instead of four positional values, so its test call sites changed.
  • dwim --help keeps its paragraph, whose first sentence now says the scan runs with the same flags. The default excludes and non-persistent filesystem types follow it, as in scan --help. Its Short drops "with the default excludes", which --no-default-excludes can now turn off.
  • README: usage line, Settings entries and the dwim mode section updated.
  • Tests: runDwim with an --exclude path leaves that pair out of the report. Through the command line, dwim --exclude / fails on its own operand before any walk. --workers 0 and an empty --exclude are usage errors. dwim -h shows the usage line and the default-excludes list. The command-line cases cannot let dwim walk /, so each one stops before the walk.
  • "--workers" in tests became the constant workersFlag; the new use crossed the linter's repeated-string limit.

Closes #162

Model: opus-5-5

`dwim` now takes `--workers`, `-x`, `--no-default-excludes` and `--exclude`, with the meaning they have for `scan`. - The flags are shared, not copied: a `scanOptions` struct, `addScanFlags` and the `check` PreRunE serve both commands. `runScan` takes the struct instead of four positional values, so its test call sites changed. - `dwim --help` keeps its paragraph, whose first sentence now says the scan runs with the same flags. The default excludes and non-persistent filesystem types follow it, as in `scan --help`. Its `Short` drops "with the default excludes", which `--no-default-excludes` can now turn off. - README: usage line, Settings entries and the `dwim` mode section updated. - Tests: `runDwim` with an `--exclude` path leaves that pair out of the report. Through the command line, `dwim --exclude /` fails on its own operand before any walk. `--workers 0` and an empty `--exclude` are usage errors. `dwim -h` shows the usage line and the default-excludes list. The command-line cases cannot let `dwim` walk `/`, so each one stops before the walk. - `"--workers"` in tests became the constant `workersFlag`; the new use crossed the linter's repeated-string limit. Closes https://git.eeqj.de/sneak/sfdupes/issues/162 Model: opus-5-5
clawbot added the needs-review label 2026-11-11 06:44:19 +01:00
clawbot self-assigned this 2026-11-11 06:44:19 +01:00
Author
Collaborator

FAIL (needs-rework)

  1. Conflicts with current next. Rebasing onto next conflicts in README.md, TODO.md, internal/sfdupes/cli.go and internal/sfdupes/cli_test.go. Since #189 merged, next gives dwim its own help paragraph, dwimHelp, and TestRunHelpDescribesDatabaseAndOutput checks it. Acceptable:

    • newDwimCommand sets Long to the short line, then dwimHelp, then defaultExcludesHelp(runtime.GOOS). The help then keeps the database text and also the list that the --no-default-excludes flag text calls "the paths listed above".
    • The first sentence of dwimHelp says dwim runs what sfdupes scan / runs with the same flags.
    • The --help bullet in README "Settings" keeps the sentences from next and adds sfdupes dwim --help to the default-excludes sentence.
    • TODO.md keeps both entries, newest first; cli_test.go keeps both helpFlag and workersFlag.
  2. internal/sfdupes/dwim_test.go, TestRunDwimHelpListsScanFlags: README "Settings" now says sfdupes dwim --help lists the default excludes and the filesystem types the walk never records anything on, but no test checks it. scan has that check in exclude_test.go. The rebase in finding 1 is where the list can drop out unnoticed. Acceptable: the test also asserts that the dwim -h output holds strings.TrimSpace(defaultExcludesHelp(runtime.GOOS)), as the scan test does.

  3. internal/sfdupes/scan.go line 102: the runScan comment says "the scan command rejects anything less" than 1 worker. dwim now passes its own --workers to runScan and rejects a value below 1 too. Acceptable: "the scan and dwim commands reject anything less".

Model: opus-5-5

**FAIL (needs-rework)** 1. Conflicts with current `next`. Rebasing onto `next` conflicts in `README.md`, `TODO.md`, `internal/sfdupes/cli.go` and `internal/sfdupes/cli_test.go`. Since https://git.eeqj.de/sneak/sfdupes/pulls/189 merged, `next` gives `dwim` its own help paragraph, `dwimHelp`, and `TestRunHelpDescribesDatabaseAndOutput` checks it. Acceptable: - `newDwimCommand` sets `Long` to the short line, then `dwimHelp`, then `defaultExcludesHelp(runtime.GOOS)`. The help then keeps the database text and also the list that the `--no-default-excludes` flag text calls "the paths listed above". - The first sentence of `dwimHelp` says `dwim` runs what `sfdupes scan /` runs with the same flags. - The `--help` bullet in README "Settings" keeps the sentences from `next` and adds `sfdupes dwim --help` to the default-excludes sentence. - `TODO.md` keeps both entries, newest first; `cli_test.go` keeps both `helpFlag` and `workersFlag`. 2. `internal/sfdupes/dwim_test.go`, `TestRunDwimHelpListsScanFlags`: README "Settings" now says `sfdupes dwim --help` lists the default excludes and the filesystem types the walk never records anything on, but no test checks it. `scan` has that check in `exclude_test.go`. The rebase in finding 1 is where the list can drop out unnoticed. Acceptable: the test also asserts that the `dwim -h` output holds `strings.TrimSpace(defaultExcludesHelp(runtime.GOOS))`, as the `scan` test does. 3. `internal/sfdupes/scan.go` line 102: the `runScan` comment says "the scan command rejects anything less" than 1 worker. `dwim` now passes its own `--workers` to `runScan` and rejects a value below 1 too. Acceptable: "the scan and dwim commands reject anything less". Model: opus-5-5
clawbot added 1 commit 2026-11-11 07:56:26 +01:00
dwim: take the scan flags (closes #162)
check / check (push) Waiting to run
dc82531aec
dwim now takes --workers, -x, --no-default-excludes and --exclude with
the meaning they have for scan. One scanOptions struct, one function
that adds the flags and one PreRunE check serve both commands, and
runScan takes the struct instead of four separate values. The dwim help
says that the scan runs with the same flags, and lists the default
excludes, as the scan help does.

Model: opus-5-5
clawbot force-pushed issue-162-dwim-scan-flags from 56301dac74 to dc82531aec 2026-11-11 07:56:26 +01:00 Compare
Author
Collaborator
  1. Fixed: rebased onto next (db56fd0) with the resolution given; new head dc82531.
  2. Fixed: TestRunDwimHelpListsScanFlags now checks the default-excludes list in the dwim -h output.
  3. Fixed: the runScan comment now names both commands.

Model: opus-5-5

1. Fixed: rebased onto `next` (`db56fd0`) with the resolution given; new head `dc82531`. 2. Fixed: `TestRunDwimHelpListsScanFlags` now checks the default-excludes list in the `dwim -h` output. 3. Fixed: the `runScan` comment now names both commands. Model: opus-5-5
Author
Collaborator

PASS: dwim takes --workers, -x, --no-default-excludes and --exclude through the same flag code as scan, dwim --help and the README list them, and a test runs dwim with --exclude.

Model: opus-5-5

**PASS**: `dwim` takes `--workers`, `-x`, `--no-default-excludes` and `--exclude` through the same flag code as `scan`, `dwim --help` and the README list them, and a test runs `dwim` with `--exclude`. Model: opus-5-5
clawbot merged commit a9ab6124ae into next 2026-11-11 08:37:19 +01:00
Sign in to join this conversation.