Skip to content

feat(cmd): -v and --version, the spellings people type - #14

Merged
Disble merged 1 commit into
mainfrom
feat/version-short-flag
Aug 30, 2026
Merged

Disble merged 1 commit into
mainfrom
feat/version-short-flag

Conversation

@Disble

@Disble Disble commented Aug 30, 2026

Copy link
Copy Markdown
Owner

ditto version shipped in 0.8.0 and answers only version, -version and
--version. This adds -v.

Nothing new is reported. The point is that a tool which makes you look up how to
ask its simplest question has not really answered it.

Why it does not collide with -verbose

Subcommands parse their flags with their own FlagSet, and Go's flag package
does no prefix matching, so -v never resolved to -verbose. Verified by
running the binary:

$ ditto -v
ditto v0.9.0
$ ditto run -v
flag provided but not defined: -v
Usage of ditto run:

Both behaviours are the ones that were there before; only the top-level dispatch
gained a case.

Checks

  • All four spellings exercised in TestVersion, and the binary built and run for
    each of them.
  • Full suite, livetree counters, lint 0 issues.
  • mutantsPerReleaseOnThisRepository unchanged at 785: a switch case adds no
    mutable expression.

`ditto version` shipped in 0.8.0 and answers only its long forms. Nothing new is
reported here; the point is that a tool which makes you look up how to ask its
simplest question has not really answered it.

Safe at this level rather than lucky: subcommands parse their flags with their
own FlagSet, and Go's flag package does no prefix matching, so `ditto run -v`
never resolved to -verbose and still does not -- it reports an undefined flag,
exactly as before. Checked by running the binary, not only the suite.
@Disble Disble added the enhancement New feature or request label Aug 30, 2026
@sonarqubecloud

Copy link
Copy Markdown

@Disble
Disble merged commit 00c51ae into main Aug 30, 2026
8 checks passed
@Disble
Disble deleted the feat/version-short-flag branch August 30, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant