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