From 9901344640a5dea76068d8afb93130e5f2a3a494 Mon Sep 17 00:00:00 2001 From: Shailja Agarwala Date: Fri, 6 Oct 2023 04:27:53 +0530 Subject: [PATCH] feat(cli): Added example to --help output for context (#15809) * docs: fix list format (#15798) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: sagarwala1 * fix(appset): add option to disable SCM providers entirely (#14246) (#15248) * feat(appset): add option to disable SCM providers entirely (#14246) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * clarify docs Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more clarification, small refactor Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * more clarification Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix test Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * refactor Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * fix test assertion Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> * simplify test expectation Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: sagarwala1 * add context example to help Signed-off-by: sagarwala1 * add context example to help Signed-off-by: sagarwala Signed-off-by: sagarwala1 * fea(cli)t: Add example to --help output for "argocd appset get" (#15808) Signed-off-by: Michele Caci Signed-off-by: sagarwala1 * fix: codeowners syntax error (#15781) Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Signed-off-by: sagarwala1 * Trigger checks again Signed-off-by: sagarwala1 Signed-off-by: sagarwala1 --------- Signed-off-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Signed-off-by: sagarwala1 Signed-off-by: Michele Caci Co-authored-by: Michael Crenshaw <350466+crenshaw-dev@users.noreply.github.com> Co-authored-by: Ishita Sequeira <46771830+ishitasequeira@users.noreply.github.com> Co-authored-by: Michele Caci --- cmd/argocd/commands/context.go | 8 ++++++++ docs/user-guide/commands/argocd_context.md | 13 +++++++++++++ 2 files changed, 21 insertions(+) diff --git a/cmd/argocd/commands/context.go b/cmd/argocd/commands/context.go index ec12aa380cd583..51d003b4df9df7 100644 --- a/cmd/argocd/commands/context.go +++ b/cmd/argocd/commands/context.go @@ -22,6 +22,14 @@ func NewContextCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command { Use: "context [CONTEXT]", Aliases: []string{"ctx"}, Short: "Switch between contexts", + Example: `# List Argo CD Contexts +argocd context + +# Switch Argo CD context +argocd context cd.argoproj.io + +# Delete Argo CD context +argocd context cd.argoproj.io --delete`, Run: func(c *cobra.Command, args []string) { localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath) diff --git a/docs/user-guide/commands/argocd_context.md b/docs/user-guide/commands/argocd_context.md index b5f16a5e367447..f02944cf4f7753 100644 --- a/docs/user-guide/commands/argocd_context.md +++ b/docs/user-guide/commands/argocd_context.md @@ -8,6 +8,19 @@ Switch between contexts argocd context [CONTEXT] [flags] ``` +### Examples + +``` +# List Argo CD Contexts +argocd context + +# Switch Argo CD context +argocd context cd.argoproj.io + +# Delete Argo CD context +argocd context cd.argoproj.io --delete +``` + ### Options ```