From 6fa4c1037bc7442a682531ea837b172daa17d6f1 Mon Sep 17 00:00:00 2001 From: Ratan Gulati Date: Tue, 10 Oct 2023 20:20:24 +0530 Subject: [PATCH] feat(cli): Add examples to --help output for "set APPNAME" (#15872) * feat: Add examples to --help output for get APPNAME Signed-off-by: Ratan Gulati * feat: Add examples to --help output for get APPNAME Signed-off-by: Ratan Gulati --------- Signed-off-by: Ratan Gulati --- cmd/argocd/commands/app.go | 17 +++++++++++++++++ docs/user-guide/commands/argocd_app_set.md | 19 +++++++++++++++++++ 2 files changed, 36 insertions(+) diff --git a/cmd/argocd/commands/app.go b/cmd/argocd/commands/app.go index ecaf5306b6eb2..55ed2ee8790f3 100644 --- a/cmd/argocd/commands/app.go +++ b/cmd/argocd/commands/app.go @@ -687,6 +687,23 @@ func NewApplicationSetCommand(clientOpts *argocdclient.ClientOptions) *cobra.Com var command = &cobra.Command{ Use: "set APPNAME", Short: "Set application parameters", + Example: templates.Examples(` + # Set application parameters for the application "my-app" + argocd app set my-app --parameter key1=value1 --parameter key2=value2 + + # Set and validate application parameters for "my-app" + argocd app set my-app --parameter key1=value1 --parameter key2=value2 --validate + + # Set and override application parameters with JSON or YAML file + argocd app set my-app --from-file path/to/parameters.json + + # Set and override application parameters with a parameter file + argocd app set my-app --parameter-file path/to/parameter-file.yaml + + # Set application parameters and specify the namespace + argocd app set my-app --parameter key1=value1 --parameter key2=value2 --namespace my-namespace + `), + Run: func(c *cobra.Command, args []string) { ctx := c.Context() diff --git a/docs/user-guide/commands/argocd_app_set.md b/docs/user-guide/commands/argocd_app_set.md index c2fcdd7bc491c..18096e16f256a 100644 --- a/docs/user-guide/commands/argocd_app_set.md +++ b/docs/user-guide/commands/argocd_app_set.md @@ -8,6 +8,25 @@ Set application parameters argocd app set APPNAME [flags] ``` +### Examples + +``` + # Set application parameters for the application "my-app" + argocd app set my-app --parameter key1=value1 --parameter key2=value2 + + # Set and validate application parameters for "my-app" + argocd app set my-app --parameter key1=value1 --parameter key2=value2 --validate + + # Set and override application parameters with JSON or YAML file + argocd app set my-app --from-file path/to/parameters.json + + # Set and override application parameters with a parameter file + argocd app set my-app --parameter-file path/to/parameter-file.yaml + + # Set application parameters and specify the namespace + argocd app set my-app --parameter key1=value1 --parameter key2=value2 --namespace my-namespace +``` + ### Options ```