blocky/cmd/version.go

26 lines
547 B
Go
Raw Permalink Normal View History

2020-04-08 23:03:07 +02:00
package cmd
import (
"fmt"
2021-08-25 22:06:34 +02:00
"github.com/0xERR0R/blocky/util"
2020-04-08 23:03:07 +02:00
"github.com/spf13/cobra"
)
// NewVersionCommand creates new command instance
2021-01-19 21:52:24 +01:00
func NewVersionCommand() *cobra.Command {
return &cobra.Command{
2020-04-08 23:03:07 +02:00
Use: "version",
Args: cobra.NoArgs,
Short: "Print the version number of blocky",
2021-02-08 21:57:59 +01:00
Run: printVersion,
2021-01-19 21:52:24 +01:00
}
2020-04-08 23:03:07 +02:00
}
2021-02-08 21:57:59 +01:00
func printVersion(_ *cobra.Command, _ []string) {
fmt.Println("blocky")
fmt.Printf("Version: %s\n", util.Version)
fmt.Printf("Build time: %s\n", util.BuildTime)
2022-09-23 20:02:03 +02:00
fmt.Printf("Architecture: %s\n", util.Architecture)
2021-02-08 21:57:59 +01:00
}