From b378590c4537c6d68ccaf176b54d7204d9e009fb Mon Sep 17 00:00:00 2001 From: Chiranjeevi R <96932059+chiranjeevir-git@users.noreply.github.com> Date: Sat, 7 Oct 2023 04:55:54 +0530 Subject: [PATCH] feat(cli): Add example to argocd relogin command (#15839) * feat: Add example to argocd relogin command Signed-off-by: Chiranjeevi R * feat: Add example to argocd relogin command Signed-off-by: Chiranjeevi R * correc --sso flag Signed-off-by: Chiranjeevi R * Apply suggestions from code review Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Chiranjeevi R Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --- cmd/argocd/commands/relogin.go | 19 +++++++++++++++---- docs/user-guide/commands/argocd_relogin.md | 11 +++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/cmd/argocd/commands/relogin.go b/cmd/argocd/commands/relogin.go index ba630270a2de7..92affe05b2e5b 100644 --- a/cmd/argocd/commands/relogin.go +++ b/cmd/argocd/commands/relogin.go @@ -24,10 +24,9 @@ func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comm ssoPort int ) var command = &cobra.Command{ - Use: "relogin", - Short: "Refresh an expired authenticate token", - Long: "Refresh an expired authenticate token", - Example: "argocd relogin --password YOUR_PASSWORD", + Use: "relogin", + Short: "Refresh an expired authenticate token", + Long: "Refresh an expired authenticate token", Run: func(c *cobra.Command, args []string) { ctx := c.Context() @@ -85,6 +84,18 @@ func NewReloginCommand(globalClientOpts *argocdclient.ClientOptions) *cobra.Comm errors.CheckError(err) fmt.Printf("Context '%s' updated\n", localCfg.CurrentContext) }, + Example: ` +# Reinitiates the login with previous contexts +argocd relogin + +# Reinitiates the login with password +argocd relogin --password YOUR_PASSWORD + +# Configure direct access using Kubernetes API server +argocd login cd.argoproj.io --core + +# If user logged in with - "argocd login cd.argoproj.io" with sso login +# The command - "argocd relogin" will Reinitiates SSO login and updates the server context`, } command.Flags().StringVar(&password, "password", "", "The password of an account to authenticate") command.Flags().IntVar(&ssoPort, "sso-port", DefaultSSOLocalPort, "Port to run local OAuth2 login application") diff --git a/docs/user-guide/commands/argocd_relogin.md b/docs/user-guide/commands/argocd_relogin.md index 40bd2b05e0cbc..430ab4a9222c9 100644 --- a/docs/user-guide/commands/argocd_relogin.md +++ b/docs/user-guide/commands/argocd_relogin.md @@ -15,7 +15,18 @@ argocd relogin [flags] ### Examples ``` + +# Reinitiates the login with previous contexts +argocd relogin + +# Reinitiates the login with password argocd relogin --password YOUR_PASSWORD + +# Configure direct access using Kubernetes API server +argocd login cd.argoproj.io --core + +# If user logged in with - "argocd login cd.argoproj.io" with sso login +# The command - "argocd relogin" will Reinitiates SSO login and updates the server context ``` ### Options