From c03c41cb21975081d80b1ae30e149e7dd312026b Mon Sep 17 00:00:00 2001 From: Lea Anthony Date: Sun, 13 Aug 2023 15:13:01 +1000 Subject: [PATCH] Add version command --- v3/cmd/wails3/main.go | 2 ++ v3/internal/commands/version.go | 15 +++++++++++++++ v3/internal/commands/version.txt | 1 + 3 files changed, 18 insertions(+) create mode 100644 v3/internal/commands/version.go create mode 100644 v3/internal/commands/version.txt diff --git a/v3/cmd/wails3/main.go b/v3/cmd/wails3/main.go index 170ddd33..5f620220 100644 --- a/v3/cmd/wails3/main.go +++ b/v3/cmd/wails3/main.go @@ -45,6 +45,8 @@ func main() { plugin.NewSubCommandFunction("init", "Initialise a new plugin", commands.PluginInit) //plugin.NewSubCommandFunction("add", "Add a plugin", commands.PluginAdd) + app.NewSubCommandFunction("version", "Print the version", commands.Version) + err := app.Run() if err != nil { pterm.Error.Println(err) diff --git a/v3/internal/commands/version.go b/v3/internal/commands/version.go new file mode 100644 index 00000000..0c6f5615 --- /dev/null +++ b/v3/internal/commands/version.go @@ -0,0 +1,15 @@ +package commands + +import ( + _ "embed" +) + +//go:embed version.txt +var VersionString string + +type VersionOptions struct{} + +func Version(_ *VersionOptions) error { + println(VersionString) + return nil +} diff --git a/v3/internal/commands/version.txt b/v3/internal/commands/version.txt new file mode 100644 index 00000000..906693d1 --- /dev/null +++ b/v3/internal/commands/version.txt @@ -0,0 +1 @@ +v3.0.0-alpha.0 \ No newline at end of file