mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-09-29 14:26:18 +00:00
* Create main.yml * Update main.yml * Update main.yml * Update main.yml * Update main.yml * trying new approach * no message * yaml error * no message * no message * no message * missing ) * no message * no message * remove main.yml and fix branches * Create tag-temp.yaml * Update tag-temp.yaml * Update tag-temp.yaml * no message * no message * no message * no message * no message * no message * no message * #minor * no message * no message * added checksum calc to CLI makefile * fixed build error - created bin directory upfront * using markdown for release text * use separate checksum files * fixed release readme * #minor * readme updated Co-authored-by: Alex Haiut <alex@up9.com>
41 lines
924 B
Go
41 lines
924 B
Go
package cmd
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/up9inc/mizu/cli/mizu"
|
|
"strconv"
|
|
"time"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
type MizuVersionOptions struct {
|
|
DebugInfo bool
|
|
}
|
|
|
|
|
|
var mizuVersionOptions = &MizuVersionOptions{}
|
|
|
|
var versionCmd = &cobra.Command{
|
|
Use: "version",
|
|
Short: "Print version info",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
if mizuVersionOptions.DebugInfo {
|
|
timeStampInt, _ := strconv.ParseInt(mizu.BuildTimestamp, 10, 0)
|
|
fmt.Printf("Version: %s \nBranch: %s (%s) \n", mizu.SemVer, mizu.Branch, mizu.GitCommitHash)
|
|
fmt.Printf("Build Time: %s (%s)\n", mizu.BuildTimestamp, time.Unix(timeStampInt, 0))
|
|
|
|
} else {
|
|
fmt.Printf("Version: %s (%s)\n", mizu.SemVer, mizu.Branch)
|
|
}
|
|
return nil
|
|
},
|
|
}
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(versionCmd)
|
|
|
|
versionCmd.Flags().BoolVarP(&mizuVersionOptions.DebugInfo, "debug", "d", false, "Provide all information about version")
|
|
|
|
}
|