From 6a27ba4895eba0b6b71f7d7d31753cdc3fa1f0eb Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 12 Jun 2023 01:18:45 -0700 Subject: [PATCH 1/2] display version --- d2cli/help.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/d2cli/help.go b/d2cli/help.go index 1a451b2ca..a786cd7b4 100644 --- a/d2cli/help.go +++ b/d2cli/help.go @@ -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 ... @@ -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 @@ -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 { From bee6e717169ce543e7e4b5883188ef06de2d863f Mon Sep 17 00:00:00 2001 From: Alexander Wang Date: Mon, 12 Jun 2023 01:19:40 -0700 Subject: [PATCH 2/2] changelog --- ci/release/changelogs/next.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a77..d191b4153 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -2,4 +2,6 @@ #### Improvements 🧹 +- Display version on CLI help invocation [#1400](https://github.com/terrastruct/d2/pull/1400) + #### Bugfixes ⛑️