From a5998f3cca608fc475704e7c27b6dc825e9fc2fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=AF=BC=EC=84=A0=20=28minnie=29?= <61786235+miinsun@users.noreply.github.com> Date: Mon, 14 Jul 2025 15:24:56 +0000 Subject: [PATCH] docs(cli): add usage examples for argo auth token command Fixes argoproj#11898 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 민선 (minnie) <61786235+miinsun@users.noreply.github.com> --- cmd/argo/commands/auth/token.go | 9 ++++++++- docs/cli/argo_auth_token.md | 12 ++++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/cmd/argo/commands/auth/token.go b/cmd/argo/commands/auth/token.go index f31ea70f5043..ad52970d4833 100644 --- a/cmd/argo/commands/auth/token.go +++ b/cmd/argo/commands/auth/token.go @@ -12,7 +12,14 @@ func NewTokenCommand() *cobra.Command { return &cobra.Command{ Use: "token", Short: "Print the auth token", - Args: cobra.NoArgs, + Example: ` +# Print the auth token for the current Argo Server + argo auth token + +# Save the token to a variable and send a request directly to the Argo API + TOKEN=$(argo auth token) && curl -H "Authorization: Bearer $TOKEN" https:///api/v1/userinfo +`, + Args: cobra.NoArgs, RunE: func(cmd *cobra.Command, args []string) error { authString, err := client.GetAuthString() if err != nil { diff --git a/docs/cli/argo_auth_token.md b/docs/cli/argo_auth_token.md index 5d33d61e8d33..15bc36230435 100644 --- a/docs/cli/argo_auth_token.md +++ b/docs/cli/argo_auth_token.md @@ -6,6 +6,18 @@ Print the auth token argo auth token [flags] ``` +### Examples + +``` + +# Print the auth token for the current Argo Server + argo auth token + +# Save the token to a variable and send a request directly to the Argo API + TOKEN=$(argo auth token) && curl -H "Authorization: Bearer $TOKEN" https:///api/v1/userinfo + +``` + ### Options ```