Skip to content

Commit

Permalink
Added a version command #377
Browse files Browse the repository at this point in the history
As I was cleaning up the docs, I noticed that a `version` command would go down well.

Signed-off-by: quobix <dave@quobix.com>
  • Loading branch information
daveshanley committed Dec 13, 2023
1 parent 2f41083 commit af6b2c1
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ func GetRootCommand() *cobra.Command {
rootCmd.AddCommand(GetHTMLReportCommand())
rootCmd.AddCommand(GetDashboardCommand())
rootCmd.AddCommand(GetGenerateRulesetCommand())
rootCmd.AddCommand(GetGenerateVersionCommand())
return rootCmd
}

Expand Down
23 changes: 23 additions & 0 deletions cmd/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Copyright 2022 Dave Shanley / Quobix
// SPDX-License-Identifier: MIT

package cmd

import (
"github.com/pterm/pterm"
"github.com/spf13/cobra"
)

func GetGenerateVersionCommand() *cobra.Command {

cmd := &cobra.Command{
Use: "version",
Short: "Prints the current version of vacuum",
Long: "Prints out the current version of vacuum to the terminal",
Example: "vacuum version",
Run: func(cmd *cobra.Command, args []string) {
pterm.Println(Version)
},
}
return cmd
}

0 comments on commit af6b2c1

Please sign in to comment.