From c0b40198d0323a2d7b277d212566367716b3c647 Mon Sep 17 00:00:00 2001 From: Michele Caci Date: Wed, 4 Oct 2023 20:05:26 +0200 Subject: [PATCH 1/2] feat: Add examples to --help output for remaining "argocd account" Signed-off-by: Michele Caci --- cmd/argocd/commands/account.go | 21 +++++++++++++++++++ docs/user-guide/commands/argocd_account.md | 16 ++++++++++++++ .../commands/argocd_account_get-user-info.md | 10 +++++++++ 3 files changed, 47 insertions(+) diff --git a/cmd/argocd/commands/account.go b/cmd/argocd/commands/account.go index 2f73dd796f89f..50035de21f2c0 100644 --- a/cmd/argocd/commands/account.go +++ b/cmd/argocd/commands/account.go @@ -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) @@ -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 + 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() diff --git a/docs/user-guide/commands/argocd_account.md b/docs/user-guide/commands/argocd_account.md index 4bd8e3aaa2699..fbc101857b578 100644 --- a/docs/user-guide/commands/argocd_account.md +++ b/docs/user-guide/commands/argocd_account.md @@ -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 ``` diff --git a/docs/user-guide/commands/argocd_account_get-user-info.md b/docs/user-guide/commands/argocd_account_get-user-info.md index a1c7b787fe0dd..e19b8928f891d 100644 --- a/docs/user-guide/commands/argocd_account_get-user-info.md +++ b/docs/user-guide/commands/argocd_account_get-user-info.md @@ -8,6 +8,16 @@ Get user info argocd account get-user-info [flags] ``` +### Examples + +``` + # Get User information + argocd account get-user-info + + # Get User information in yaml format + argocd account get-user-info -o yaml +``` + ### Options ``` From 23cff8a963341a324231dc859f2acc3372a758f7 Mon Sep 17 00:00:00 2001 From: Michele Caci Date: Thu, 5 Oct 2023 10:18:43 +0200 Subject: [PATCH 2/2] Update cmd/argocd/commands/account.go Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: Michele Caci --- cmd/argocd/commands/account.go | 2 +- docs/user-guide/commands/argocd_account_get-user-info.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/argocd/commands/account.go b/cmd/argocd/commands/account.go index 50035de21f2c0..5472859551f75 100644 --- a/cmd/argocd/commands/account.go +++ b/cmd/argocd/commands/account.go @@ -158,7 +158,7 @@ func NewAccountGetUserInfoCommand(clientOpts *argocdclient.ClientOptions) *cobra Use: "get-user-info", Short: "Get user info", Example: templates.Examples(` - # Get User information + # Get User information for the currently logged-in user (see 'argocd login') argocd account get-user-info # Get User information in yaml format diff --git a/docs/user-guide/commands/argocd_account_get-user-info.md b/docs/user-guide/commands/argocd_account_get-user-info.md index e19b8928f891d..66603a52b2628 100644 --- a/docs/user-guide/commands/argocd_account_get-user-info.md +++ b/docs/user-guide/commands/argocd_account_get-user-info.md @@ -11,7 +11,7 @@ argocd account get-user-info [flags] ### Examples ``` - # Get User information + # Get User information for the currently logged-in user (see 'argocd login') argocd account get-user-info # Get User information in yaml format