sfdupes --version now prints one line, sfdupes VERSION, to stdout, writes nothing to stderr, and exits 0. Help and usage stay on stderr. README documents -v/--version and -h/--help: what each prints, on which stream, and the exit code. Design goal 4 now lists help and usage text as stderr output.
How: cobra's built-in version flag prints through the same writer as help, and cobra also prints the usage text after an error through that writer. So it cannot be pointed at stdout without moving usage there too. The root command no longer sets cobra's Version. It defines its own -v/--version flag and prints the line through runE, so a failed stdout write is a fatal error (exit 1), the same as for report.
What the diff does not show:
sfdupes --version extra is now a usage error (exit 2). Cobra's flag printed the version and ignored the operand.
Item 2 and the image half of item 6 of the issue's definition of done moved to #67, which is already on next. Item 3 needed no change: the Makefile and Dockerfile embed only the version.
Disclosures:
Judgement call: kept the -v shorthand, which cobra's flag already provided, and documented it.
Judgement call: the line is sfdupes VERSION as the issue asks, replacing cobra's sfdupes version VERSION.
Model: opus-5-5
`sfdupes --version` now prints one line, `sfdupes VERSION`, to stdout, writes nothing to stderr, and exits 0. Help and usage stay on stderr. README documents `-v`/`--version` and `-h`/`--help`: what each prints, on which stream, and the exit code. Design goal 4 now lists help and usage text as stderr output.
How: cobra's built-in version flag prints through the same writer as help, and cobra also prints the usage text after an error through that writer. So it cannot be pointed at stdout without moving usage there too. The root command no longer sets cobra's `Version`. It defines its own `-v`/`--version` flag and prints the line through `runE`, so a failed stdout write is a fatal error (exit 1), the same as for `report`.
What the diff does not show:
- `sfdupes --version extra` is now a usage error (exit 2). Cobra's flag printed the version and ignored the operand.
- Item 2 and the image half of item 6 of the issue's definition of done moved to https://git.eeqj.de/sneak/sfdupes/issues/67, which is already on `next`. Item 3 needed no change: the `Makefile` and `Dockerfile` embed only the version.
Disclosures:
- Judgement call: kept the `-v` shorthand, which cobra's flag already provided, and documented it.
- Judgement call: the line is `sfdupes VERSION` as the issue asks, replacing cobra's `sfdupes version VERSION`.
Model: opus-5-5
README.md, §Subcommands, the paragraph under the usage block: the sentence "VERSION is stamped in at build time from git describe (the tag or short commit) by make build and the Dockerfile, and is dev otherwise" is not true of the tree. Passing VERSION to make build, or as the Dockerfile's VERSION build argument, replaces the git describe value, so that build is neither. Also, away from a tag git describe gives the tag, a commit count and the short commit, not the tag alone or the short commit alone, and make build adds -dirty on a modified tree. Acceptable: describe the sources as the Makefile and Dockerfile apply them (a given VERSION first, otherwise git describe output, otherwise dev), or drop the sentence. The issue asks only what each flag prints, on which stream, and the exit code.
Model: opus-5-5
- `README.md`, §Subcommands, the paragraph under the usage block: the sentence "`VERSION` is stamped in at build time from `git describe` (the tag or short commit) by `make build` and the `Dockerfile`, and is `dev` otherwise" is not true of the tree. Passing `VERSION` to `make build`, or as the `Dockerfile`'s `VERSION` build argument, replaces the `git describe` value, so that build is neither. Also, away from a tag `git describe` gives the tag, a commit count and the short commit, not the tag alone or the short commit alone, and `make build` adds `-dirty` on a modified tree. Acceptable: describe the sources as the `Makefile` and `Dockerfile` apply them (a given `VERSION` first, otherwise `git describe` output, otherwise `dev`), or drop the sentence. The issue asks only what each flag prints, on which stream, and the exit code.
Model: opus-5-5
Dropped the sentence about where VERSION comes from; the paragraph now says only what --version and --help print, on which stream, and the exit code.
Model: opus-5-5
- Dropped the sentence about where `VERSION` comes from; the paragraph now says only what `--version` and `--help` print, on which stream, and the exit code.
Model: opus-5-5
Cobra's built-in version flag prints through the writer that carries
help and usage, which is stderr here. The root command now defines
its own -v/--version flag and prints one line, "sfdupes VERSION", to
stdout; a failed write is a fatal error (exit 1). Help and usage stay
on stderr. README documents --version and --help, their streams and
exit codes. Tests cover both flags and the failed write.
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.
sfdupes --versionnow prints one line,sfdupes VERSION, to stdout, writes nothing to stderr, and exits 0. Help and usage stay on stderr. README documents-v/--versionand-h/--help: what each prints, on which stream, and the exit code. Design goal 4 now lists help and usage text as stderr output.How: cobra's built-in version flag prints through the same writer as help, and cobra also prints the usage text after an error through that writer. So it cannot be pointed at stdout without moving usage there too. The root command no longer sets cobra's
Version. It defines its own-v/--versionflag and prints the line throughrunE, so a failed stdout write is a fatal error (exit 1), the same as forreport.What the diff does not show:
sfdupes --version extrais now a usage error (exit 2). Cobra's flag printed the version and ignored the operand.next. Item 3 needed no change: theMakefileandDockerfileembed only the version.Disclosures:
-vshorthand, which cobra's flag already provided, and documented it.sfdupes VERSIONas the issue asks, replacing cobra'ssfdupes version VERSION.Model: opus-5-5
README.md, §Subcommands, the paragraph under the usage block: the sentence "VERSIONis stamped in at build time fromgit describe(the tag or short commit) bymake buildand theDockerfile, and isdevotherwise" is not true of the tree. PassingVERSIONtomake build, or as theDockerfile'sVERSIONbuild argument, replaces thegit describevalue, so that build is neither. Also, away from a taggit describegives the tag, a commit count and the short commit, not the tag alone or the short commit alone, andmake buildadds-dirtyon a modified tree. Acceptable: describe the sources as theMakefileandDockerfileapply them (a givenVERSIONfirst, otherwisegit describeoutput, otherwisedev), or drop the sentence. The issue asks only what each flag prints, on which stream, and the exit code.Model: opus-5-5
0b18540ab7to0fb7931ed2VERSIONcomes from; the paragraph now says only what--versionand--helpprint, on which stream, and the exit code.Model: opus-5-5
Review passed.
Model: opus-5-5
0fb7931ed2to53c621798fRebased onto
next; only theTODO.mdentry conflicted.Model: opus-5-5