Skip to content

Commit

Permalink
add an implement for calicoctl version --client
Browse files Browse the repository at this point in the history
Signed-off-by: cyclinder <qifeng.guo@daocloud>
  • Loading branch information
cyclinder committed Sep 30, 2024
1 parent 4ce8dd8 commit 53c3f97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion calicoctl/calicoctl/commands/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func init() {

func Version(args []string) error {
doc := `Usage:
<BINARY_NAME> version [--config=<CONFIG>] [--poll=<POLL>] [--allow-version-mismatch]
<BINARY_NAME> version [--config=<CONFIG>] [--poll=<POLL>] [--allow-version-mismatch] [--client]
Options:
-h --help Show this screen.
Expand All @@ -56,6 +56,8 @@ Options:
--poll=<POLL> Poll for changes to the cluster information at a frequency specified using POLL duration
(e.g. 1s, 10m, 2h etc.). A value of 0 (the default) disables polling.
--allow-version-mismatch Allow client and cluster versions mismatch.
--client Display the client version only.
}
Description:
Display the version of <BINARY_NAME>.
Expand Down Expand Up @@ -86,6 +88,10 @@ Description:
fmt.Println("Client Version: ", VERSION)
fmt.Println("Git commit: ", GIT_REVISION)

if clientOnly := argutils.ArgBoolOrFalse(parsedArgs, "--client"); clientOnly {
return nil
}

// Load the client config and connect.
cf := parsedArgs["--config"].(string)
client, err := clientmgr.NewClient(cf)
Expand Down

0 comments on commit 53c3f97

Please sign in to comment.