diff --git a/cmd/atlantis.go b/cmd/atlantis.go index 560dc7da9..8c3f6e329 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 a65b13fdd..38524824b 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 0c62ba872..dde42a071 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 900877f37..724a45681 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 452956b8c..0c45d7ea1 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 4c6d74698..2e387e9a2 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