Skip to content

-V prints Graphviz's line, on standard error: "dot - graphviz version 16.1.1 (…)" - #163

Open
closer-claudio wants to merge 2 commits into
mainfrom
claudio/20261122-version-line
Open

closer-claudio wants to merge 2 commits into
mainfrom
claudio/20261122-version-line

Conversation

@closer-claudio

Copy link
Copy Markdown
Contributor

Graphviz's dot answers -V with one line on standard error and exits 0: dot - graphviz version 16.1.1 (20261108.1752) is Homebrew's. This command printed its own version alone on standard output (v1.5.0, or (devel)), so what reads the Graphviz release out of dot -V, as build scripts and editors' plugins do, read nothing from it.

-V now prints that line, in that shape and on that stream:

dot - graphviz version 16.1.1 (forkcloser/dot v1.5.0)

The Graphviz release is the one the engine embeds, asked of the engine (graphviz.Version, which go-graphviz has since forkcloser/go-graphviz#253; go.mod requires that commit). The parenthesis holds this command's version where Graphviz's dot has its build date, devel for a build with no version. Standard output has nothing. A version the engine cannot give is an error and exit 1.

Breaking: a caller that read the command's own version from standard output now finds it in the parenthesis of the line on standard error.

Tests: TestVersionIsGraphvizsLine holds the line's shape, the stream and the exit, that the release is the one the engine is pinned to, and, under DOT_ORACLE, that the native dot's line has the same shape and the same major and minor release. The contract table's -V rows expect the line on standard error and nothing on standard output.

Stacked on #161, whose commit this page shows until that one merges.

closer-claudio and others added 2 commits November 23, 2026 08:36
…and, as in Graphviz

Graphviz's dot takes -? for its help: usage on standard output, exit 0.
The command called it an unknown flag. It now takes -? as it takes -h
(which Graphviz's dot does not have, and which stays).

Graphviz's dot acts on -? and -V where it meets them and reads nothing
after: `dot -? -Tnope` and `dot -V -Tnope` exit 0, `dot -Tnope -?` exits
1, `dot -V -?` prints the version. The command read the whole line first,
so a bad flag anywhere won over the help, and -h won over -V wherever
each stood. parseArgs now returns at the first of them.

TestTheFirstOfHelpAndVersionIsTheWholeCommand holds seven orderings, each
also run against the native dot under DOT_ORACLE (all seven agree with
16.1.1); the contract table gains -? and the orderings with their
streams, TestParseArgs the same at the parser.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
… 16.1.1 (…)"

Graphviz's dot answers -V with one line on standard error and exits 0:
"dot - graphviz version 16.1.1 (20261108.1752)" is Homebrew's. The
command printed its own version alone on standard output ("v1.5.0", or
"(devel)"), so what reads the Graphviz release out of `dot -V`, as build
scripts and editors' plugins do, read nothing from it.

-V now prints that line, in that shape and on that stream: the Graphviz
release is the one the engine embeds, asked of the engine
(graphviz.Version, which go-graphviz has from adc5c5a, the version go.mod
now requires), and the parenthesis holds this command's version where
Graphviz's dot has its build date: "(forkcloser/dot v1.5.0)", "devel" for
a build with no version. Standard output has nothing. A version the
engine cannot give is an error and exit 1.

This breaks a caller that read the command's own version from standard
output.

TestVersionIsGraphvizsLine holds the line's shape, the stream and the
exit, that the release is the one the engine is pinned to, and, under
DOT_ORACLE, that the native dot's line has the same shape and the same
major and minor release. The contract table's -V rows expect the line on
standard error and nothing on standard output.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Signed-off-by: closer-claudio <claudio@farcloser.world>
@closer-claudio closer-claudio added the breaking Breaks a consumer label Nov 23, 2026
@closer-claudio

Copy link
Copy Markdown
Contributor Author

Reviewed at 861f381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaks a consumer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant