From 018793e2b22b9bfebbf9edd373054028fb72cb9c Mon Sep 17 00:00:00 2001 From: Sam Tholiya Date: Thu, 23 Jan 2025 21:45:37 +0100 Subject: [PATCH] example hint updated --- cmd/atlantis.go | 1 + cmd/aws.go | 1 + cmd/helmfile.go | 1 + cmd/markdown_help.go | 2 ++ cmd/terraform.go | 2 ++ tests/test-cases/help-and-usage.yaml | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/cmd/atlantis.go b/cmd/atlantis.go index 560dc7da9c..8c3f6e3296 100644 --- a/cmd/atlantis.go +++ b/cmd/atlantis.go @@ -14,5 +14,6 @@ var atlantisCmd = &cobra.Command{ } func init() { + atlantisCmd.PersistentFlags().Bool("", false, doubleDashHint) RootCmd.AddCommand(atlantisCmd) } diff --git a/cmd/aws.go b/cmd/aws.go index a65b13fdd4..38524824b6 100644 --- a/cmd/aws.go +++ b/cmd/aws.go @@ -14,5 +14,6 @@ var awsCmd = &cobra.Command{ } func init() { + awsCmd.PersistentFlags().Bool("", false, doubleDashHint) RootCmd.AddCommand(awsCmd) } diff --git a/cmd/helmfile.go b/cmd/helmfile.go index 0c62ba872f..dde42a0714 100644 --- a/cmd/helmfile.go +++ b/cmd/helmfile.go @@ -20,6 +20,7 @@ func init() { // https://github.com/spf13/cobra/issues/739 helmfileCmd.DisableFlagParsing = true helmfileCmd.PersistentFlags().StringP("stack", "s", "", "atmos helmfile -s ") + helmfileCmd.PersistentFlags().Bool("", false, doubleDashHint) RootCmd.AddCommand(helmfileCmd) } diff --git a/cmd/markdown_help.go b/cmd/markdown_help.go index 900877f37f..724a456810 100644 --- a/cmd/markdown_help.go +++ b/cmd/markdown_help.go @@ -16,6 +16,8 @@ type ExampleContent struct { Suggestion string } +var doubleDashHint string = "Double dashes can be used to signify the end of Atmos-specific options and the beginning of additional native arguments and flags for the specific command being run." + var examples map[string]ExampleContent = map[string]ExampleContent{ "atmos_terraform": { Content: terraform, diff --git a/cmd/terraform.go b/cmd/terraform.go index 452956b8c7..0c45d7ea14 100644 --- a/cmd/terraform.go +++ b/cmd/terraform.go @@ -18,6 +18,7 @@ var terraformCmd = &cobra.Command{ Short: "Execute Terraform commands (e.g., plan, apply, destroy) using Atmos stack configurations", Long: `This command allows you to execute Terraform commands, such as plan, apply, and destroy, using Atmos stack configurations for consistent infrastructure management.`, FParseErrWhitelist: struct{ UnknownFlags bool }{UnknownFlags: true}, + Example: `atmos terraform [sub-command] -s `, PostRunE: func(cmd *cobra.Command, args []string) error { info := getConfigAndStacksInfo("terraform", cmd, args) return hooks.RunE(cmd, args, &info) @@ -50,6 +51,7 @@ func init() { // https://github.com/spf13/cobra/issues/739 terraformCmd.DisableFlagParsing = true terraformCmd.PersistentFlags().StringP("stack", "s", "", "atmos terraform -s ") + terraformCmd.PersistentFlags().Bool("", false, doubleDashHint) attachTerraformCommands(terraformCmd) RootCmd.AddCommand(terraformCmd) } diff --git a/tests/test-cases/help-and-usage.yaml b/tests/test-cases/help-and-usage.yaml index 4c6d746981..2e387e9a24 100644 --- a/tests/test-cases/help-and-usage.yaml +++ b/tests/test-cases/help-and-usage.yaml @@ -566,4 +566,4 @@ tests: - "--check" - "--non-existent" expect: - exit_code: 1 \ No newline at end of file + exit_code: 1