You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add --client flag to pgo version to return only pgo client version
This skips making a call to the API server so the user can know the
version of the pgo client that they are using. This mimics the kubectl
functionality, i.e. `kubectl version --client`.
Issue: #1600
Copy file name to clipboardExpand all lines: pgo/cmd/version.go
+17-6Lines changed: 17 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -24,6 +24,10 @@ import (
24
24
"os"
25
25
)
26
26
27
+
// ClientVersionOnly indicates that only the client version should be returned, not make
28
+
// a call to the server
29
+
varClientVersionOnlybool
30
+
27
31
varversionCmd=&cobra.Command{
28
32
Use: "version",
29
33
Short: "Print version information for the PostgreSQL Operator",
@@ -38,24 +42,31 @@ var versionCmd = &cobra.Command{
38
42
39
43
funcinit() {
40
44
RootCmd.AddCommand(versionCmd)
45
+
versionCmd.Flags().BoolVar(&ClientVersionOnly, "client", false, "Only return the version of the pgo client. This does not make a call to the API server.")
41
46
}
42
47
43
48
funcshowVersion() {
44
49
50
+
// print the client version
51
+
fmt.Println("pgo client version "+msgs.PGO_VERSION)
52
+
53
+
// if the user selects only to display the client version, return here
0 commit comments