Skip to content

Commit cf338aa

Browse files
committed
add version --verbose flag displaying fips mode
1 parent 02e1a59 commit cf338aa

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

ziti/cmd/common/version.go

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,31 @@ package common
1818

1919
import (
2020
"fmt"
21+
"github.com/openziti/foundation/v2/tlz"
2122
"github.com/openziti/ziti/common/version"
2223
"github.com/spf13/cobra"
2324
)
2425

2526
func NewVersionCmd() *cobra.Command {
26-
return &cobra.Command{
27+
var verbose bool
28+
29+
cmd := &cobra.Command{
2730
Use: "version",
2831
Short: "Show component version",
2932
Run: func(cmd *cobra.Command, args []string) {
30-
fmt.Println(version.GetVersion())
33+
if verbose {
34+
fmt.Printf("Version: %s\n", version.GetVersion())
35+
fmt.Printf("Revision: %s\n", version.GetRevision())
36+
fmt.Printf("Build Date: %s\n", version.GetBuildDate())
37+
fmt.Printf("Go Version: %s\n", version.GetGoVersion())
38+
fmt.Printf("OS/Arch: %s/%s\n", version.GetOS(), version.GetArchitecture())
39+
fmt.Printf("FIPS: %v\n", tlz.FipsEnabled())
40+
} else {
41+
fmt.Println(version.GetVersion())
42+
}
3143
},
3244
}
45+
46+
cmd.Flags().BoolVarP(&verbose, "verbose", "v", false, "Show verbose version information")
47+
return cmd
3348
}

0 commit comments

Comments
 (0)