bug: --csv / --xlsx silently ignore --output
Author: twelfthlaborCreated Sep 10, 2026Updated Sep 10, 2026
Summary
--output FILE is only consumed by the --txt branch. The --csv and --xlsx branches hardcode their filenames (f"{username}.csv" at sherlock.py:846, f"{username}.xlsx" at :927) and never consult args.output.
Observed behavior (all offline-reproducible via a stubbed sherlock())
| Invocation | Result |
|---|---|
--csv --output out.csv daniel |
out.csv never created; real CSV lands at daniel.csv in CWD |
--csv --txt --output out.csv daniel |
out.csv contains the TXT report; real CSV still at daniel.csv |
--xlsx --output out.xlsx daniel |
out.xlsx never created; real xlsx at daniel.xlsx |
--xlsx --txt --output out.xlsx daniel |
out.xlsx is a plain-text file with txt content, not a spreadsheet |
control: --txt --output out.txt |
honored correctly |
Notes
- Adjacent to but distinct from #2992 ("--output ignored unless --txt passed"): here
--txtIS passed and the csv/xlsx output is still silently written elsewhere. - ⚠️ Interaction warning: open PRs #3083/#3039/#2993 (all proposing the same gate change) modify the txt gate to
if args.output_txt or args.output:— if merged,--csv --output out.csvwould additionally write txt content intoout.csveven without--txt. That widening should be considered in whatever design is chosen here.
Design questions for maintainers
With --csv --txt --output FILE:
- Honor
--outputfor every requested format (both writes target the same path — last-write-wins corruption)? - Refuse the combo (exit 1, like the existing
--output/--folderoutputconflict guard at ~728-730)? - Derive per-format paths from the
--outputstem?
Happy to implement whichever is preferred — requesting direction before PRing, since the correct semantics are a product decision.
Environment: macOS, Python 3.13, master @ 3760187 (line refs verified).
Source: sherlock-project/sherlock