diff --git a/cli/cli.go b/cli/cli.go index 0dbde35..758d82e 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -2,6 +2,7 @@ package cli import ( extCmd "dredger/cmd" + "dredger/core" gen "dredger/generator" "errors" "os" @@ -26,6 +27,15 @@ var rootCmd = &cobra.Command{ Long: "Generate Go-Server code and RapidDoc-Clientcode for your application by providing an OpenAPI Specification", } +var showVersion = &cobra.Command{ + Use: "version", + Short: "Show the version of the dredger tool", + Args: cobra.ExactArgs(0), + Run: func(cmd *cobra.Command, args []string) { + println("dredger v" + core.Version) + }, +} + var generateBdd = &cobra.Command{ Use: "generate-bdd ", Short: "Create BDD test file from the feature file", @@ -119,4 +129,7 @@ func init() { //add bdd command rootCmd.AddCommand(generateBdd) + + // add version command + rootCmd.AddCommand(showVersion) } diff --git a/core/core.go b/core/core.go new file mode 100644 index 0000000..bc5e7e3 --- /dev/null +++ b/core/core.go @@ -0,0 +1,13 @@ +package core + +import ( + _ "embed" + "strings" +) + +var ( + // Version labels the release + Version string = strings.TrimSpace(version) + //go:embed version + version string +) diff --git a/core/version b/core/version index 599028f..109a20f 100644 --- a/core/version +++ b/core/version @@ -1 +1 @@ -0.2.21 +0.2.22