Skip to content

Commit

Permalink
Allow user to get version without a server
Browse files Browse the repository at this point in the history
  • Loading branch information
jmckulk committed Jan 23, 2024
1 parent 857b133 commit f074927
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ func newVersionCommand(config *internal.Config) *cobra.Command {
// No arguments for 'version'
cmd.Args = cobra.NoArgs

var clientOnly bool
cmd.Flags().BoolVar(&clientOnly, "client", false, "If true, shows client version only (no server required).")

cmd.Example = internal.FormatExample(fmt.Sprintf(`# Request the version of the client and the operator
pgo version
Expand All @@ -57,6 +60,9 @@ Operator Version: v5.5.0`, clientVersion))
cmd.RunE = func(cmd *cobra.Command, args []string) error {

cmd.Printf("Client Version: %s\n", clientVersion)
if clientOnly {
return nil
}

ctx := context.Background()
restConfig, err := config.ToRESTConfig()
Expand Down

0 comments on commit f074927

Please sign in to comment.