Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project are documented here. The format follows
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.10.0] - 2026-08-30

### Added

- **`-v` and `--version` alongside `ditto version`.** Nothing new is reported;
it is the spelling people actually type, and a tool that only answers the long
form makes them look it up to ask the simplest question it has.

Safe at this level rather than lucky: subcommand flags are parsed by 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,
as it always did.

## [0.9.0] - 2026-08-30

The release that makes ditto's own gate finish, by making it ask a question it
Expand Down Expand Up @@ -671,6 +684,7 @@ here, not yet built.
- The `retract` block. It named published versions of the upstream module path,
which do not exist under this one.

[0.10.0]: https://github.com/Disble/ditto/releases/tag/v0.10.0
[0.9.0]: https://github.com/Disble/ditto/releases/tag/v0.9.0
[0.8.0]: https://github.com/Disble/ditto/releases/tag/v0.8.0
[0.7.0]: https://github.com/Disble/ditto/releases/tag/v0.7.0
Expand Down
3 changes: 2 additions & 1 deletion cmd/ditto/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func command(args []string, help io.Writer) error {
usage(help)

return nil
case "-version", "--version", "version":
case "-v", "-version", "--version", "version":
fmt.Fprintln(help, versionLine(buildVersion()))

return nil
Expand Down Expand Up @@ -103,6 +103,7 @@ func usage(out io.Writer) {
ditto staged [flags] mutate only what a staged change justifies
ditto changed [flags] mutate only what a committed change justifies
ditto version the module version this binary was built from
(also -v, --version)

Run `+"`ditto run -h`"+` for its flags.
`)
Expand Down
5 changes: 4 additions & 1 deletion cmd/ditto/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ func TestVersion(t *testing.T) {
assert.Equal(t, "ditto (built from source; no released version recorded)", versionLine(""))
})

for _, argument := range []string{"--version", "-version", "version"} {
// -v as well as --version, because that is what people type. It is safe at
// this level: subcommand flags are parsed by their own FlagSet, and Go's flag
// package does no prefix matching, so `ditto run -v` was never a thing.
for _, argument := range []string{"--version", "-version", "-v", "version"} {
t.Run(argument+" reports the version and does not fail", func(t *testing.T) {
out := &bytes.Buffer{}

Expand Down
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ a gate rather than a test:
```shell
go install github.com/Disble/ditto/cmd/ditto@latest

ditto version # which build is this?
ditto version # which build is this? (also -v, --version)
ditto run --threshold 0.8 # mutate the repository
ditto staged --dry # what would a staged change cost?
ditto staged --threshold 0.8 # mutate only what it justifies
Expand Down
Loading