Skip to content

Commit

Permalink
feat(cli): Add example to argocd relogin command (argoproj#15839)
Browse files Browse the repository at this point in the history
* feat: Add example to argocd relogin command

Signed-off-by: Chiranjeevi R <chiranjeevi.ramanatha@gmail.com>

* feat: Add example to argocd relogin command

Signed-off-by: Chiranjeevi R <chiranjeevi.ramanatha@gmail.com>

* correc --sso flag

Signed-off-by: Chiranjeevi R <chiranjeevi.ramanatha@gmail.com>

* Apply suggestions from code review

Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>

---------

Signed-off-by: Chiranjeevi R <chiranjeevi.ramanatha@gmail.com>
Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: jmilic1 <70441727+jmilic1@users.noreply.github.com>
  • Loading branch information
2 people authored and jmilic1 committed Nov 13, 2023
1 parent f829fd8 commit f994749
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
19 changes: 15 additions & 4 deletions cmd/argocd/commands/relogin.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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")
Expand Down
11 changes: 11 additions & 0 deletions docs/user-guide/commands/argocd_relogin.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit f994749

Please sign in to comment.