Skip to content

Commit

Permalink
feat(cli): Add examples to --help output for remaining "argocd accoun…
Browse files Browse the repository at this point in the history
…t" (#15814)

* feat: Add examples to --help output for remaining "argocd account"

Signed-off-by: Michele Caci <michele.caci@gmail.com>

* Update cmd/argocd/commands/account.go

Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
Signed-off-by: Michele Caci <michele.caci@gmail.com>

---------

Signed-off-by: Michele Caci <michele.caci@gmail.com>
Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com>
  • Loading branch information
mcaci and crenshaw-dev authored Oct 6, 2023
1 parent 91f107f commit 498f47e
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
21 changes: 21 additions & 0 deletions cmd/argocd/commands/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,26 @@ import (
"github.com/argoproj/argo-cd/v2/util/io"
"github.com/argoproj/argo-cd/v2/util/localconfig"
sessionutil "github.com/argoproj/argo-cd/v2/util/session"
"github.com/argoproj/argo-cd/v2/util/templates"
)

func NewAccountCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
var command = &cobra.Command{
Use: "account",
Short: "Manage account settings",
Example: templates.Examples(`
# List accounts
argocd account list
# Update the current user's password
argocd account update-password
# Can I sync any app?
argocd account can-i sync applications '*'
# Get User information
argocd account get-user-info
`),
Run: func(c *cobra.Command, args []string) {
c.HelpFunc()(c, args)
os.Exit(1)
Expand Down Expand Up @@ -143,6 +157,13 @@ func NewAccountGetUserInfoCommand(clientOpts *argocdclient.ClientOptions) *cobra
var command = &cobra.Command{
Use: "get-user-info",
Short: "Get user info",
Example: templates.Examples(`
# Get User information for the currently logged-in user (see 'argocd login')
argocd account get-user-info
# Get User information in yaml format
argocd account get-user-info -o yaml
`),
Run: func(c *cobra.Command, args []string) {
ctx := c.Context()

Expand Down
16 changes: 16 additions & 0 deletions docs/user-guide/commands/argocd_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,22 @@ Manage account settings
argocd account [flags]
```

### Examples

```
# List accounts
argocd account list
# Update the current user's password
argocd account update-password
# Can I sync any app?
argocd account can-i sync applications '*'
# Get User information
argocd account get-user-info
```

### Options

```
Expand Down
10 changes: 10 additions & 0 deletions docs/user-guide/commands/argocd_account_get-user-info.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ Get user info
argocd account get-user-info [flags]
```

### Examples

```
# Get User information for the currently logged-in user (see 'argocd login')
argocd account get-user-info
# Get User information in yaml format
argocd account get-user-info -o yaml
```

### Options

```
Expand Down

0 comments on commit 498f47e

Please sign in to comment.