mirror of
https://github.com/Luzifer/ots.git
synced 2024-12-18 12:04:35 -05:00
[#159] Add version-command for ots-cli
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
47a7a686ef
commit
f2a7af30b2
19
cmd/ots-cli/cmd_version.go
Normal file
19
cmd/ots-cli/cmd_version.go
Normal file
@ -0,0 +1,19 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var versionCmd = &cobra.Command{
|
||||
Use: "version",
|
||||
Short: "Displays the tool version",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
fmt.Printf("ots-cli %s\n", version) //nolint:forbidigo
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
}
|
@ -4,6 +4,8 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
var version = "dev"
|
||||
|
||||
func main() {
|
||||
if err := rootCmd.Execute(); err != nil {
|
||||
os.Exit(1)
|
||||
|
Loading…
Reference in New Issue
Block a user