Skip to content

Commit

Permalink
Merge pull request #1400 from alixander/display-version
Browse files Browse the repository at this point in the history
cli: display version
  • Loading branch information
alixander authored Jun 12, 2023
2 parents 90297e1 + bee6e71 commit 34dfae6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 2 additions & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

#### Improvements 🧹

- Display version on CLI help invocation [#1400](https://github.com/terrastruct/d2/pull/1400)

#### Bugfixes ⛑️
8 changes: 5 additions & 3 deletions d2cli/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import (

"oss.terrastruct.com/d2/d2plugin"
"oss.terrastruct.com/d2/d2themes/d2themescatalog"
"oss.terrastruct.com/d2/lib/version"
)

func help(ms *xmain.State) {
fmt.Fprintf(ms.Stdout, `Usage:
fmt.Fprintf(ms.Stdout, `%[1]s %[2]s
Usage:
%[1]s [--watch=false] [--theme=0] file.d2 [file.svg | file.png]
%[1]s layout [name]
%[1]s fmt file.d2 ...
Expand All @@ -29,7 +31,7 @@ Use - to have d2 read from stdin or write to stdout.
See man d2 for more detailed docs.
Flags:
%s
%[3]s
Subcommands:
%[1]s layout - Lists available layout engine options with short help
Expand All @@ -40,7 +42,7 @@ Subcommands:
See more docs and the source code at https://oss.terrastruct.com/d2.
Hosted icons at https://icons.terrastruct.com.
Playground runner at https://play.d2lang.com.
`, filepath.Base(ms.Name), ms.Opts.Defaults())
`, filepath.Base(ms.Name), version.Version, ms.Opts.Defaults())
}

func layoutCmd(ctx context.Context, ms *xmain.State, ps []d2plugin.Plugin) error {
Expand Down

0 comments on commit 34dfae6

Please sign in to comment.