Skip to content

Commit

Permalink
remove old help code
Browse files Browse the repository at this point in the history
  • Loading branch information
samtholiya committed Dec 24, 2024
1 parent 0f3f84e commit 84a1033
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 47 deletions.
10 changes: 9 additions & 1 deletion cmd/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,15 @@ func terraformRun(cmd *cobra.Command, args []string) error {
// Exit on help
if info.NeedHelp {
if info.SubCommand != "" {
fmt.Printf(`Error: Unknkown command %q for %q`+"\n", args[0], cmd.CommandPath())
suggestions := cmd.SuggestionsFor(args[0])
if len(suggestions) > 0 {
fmt.Printf("Unknown command: '%s'\n\nDid you mean this?\n", args[0])
for _, suggestion := range suggestions {
fmt.Printf(" %s\n", suggestion)
}
} else {
fmt.Printf(`Error: Unknkown command %q for %q`+"\n", args[0], cmd.CommandPath())
}
fmt.Printf(`Run '%s --help' for usage`+"\n", cmd.CommandPath())
return fmt.Errorf("unknown command %q for %q", args[0], cmd.CommandPath())
}
Expand Down
46 changes: 0 additions & 46 deletions internal/exec/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,52 +29,6 @@ func processHelp(
u.PrintMessage(" - double-dash '--' can be used to signify the end of the options for Atmos and the start of the additional " +
"native arguments and flags for the 'helmfile' commands")
}
} else if componentType == "terraform" && command == "clean" {
u.PrintMessage("\n'atmos terraform clean' command deletes the following folders and files from the component's directory:\n\n" +
" - '.terraform' folder\n" +
" - folder that the 'TF_DATA_DIR' ENV var points to\n" +
" - '.terraform.lock.hcl' file\n" +
" - generated varfile for the component in the stack\n" +
" - generated planfile for the component in the stack\n" +
" - generated 'backend.tf.json' file\n" +
" - 'terraform.tfstate.d' folder (if '--everything' flag is used)\n\n" +
"Usage: atmos terraform clean <component> -s <stack> <flags>\n\n" +
"Use '--everything' flag to also delete the Terraform state files and and directories with confirm message.\n\n" +
"Use --force to forcefully delete Terraform state files and directories for the component.\n\n" +
"- If no component is specified, the command will apply to all components and stacks.\n" +
"- If no stack is specified, the command will apply to all stacks for the specified component.\n" +
"Use '--skip-lock-file' flag to skip deleting the '.terraform.lock.hcl' file.\n\n" +
"If no component or stack is specified, the clean operation will apply globally to all components.\n\n" +
"For more details refer to https://atmos.tools/cli/commands/terraform/clean\n")

} else if componentType == "terraform" && command == "deploy" {
u.PrintMessage("\n'atmos terraform deploy' command executes 'terraform apply -auto-approve' on an Atmos component in an Atmos stack.\n\n" +
"Usage: atmos terraform deploy <component> -s <stack> <flags>\n\n" +
"The command automatically sets '-auto-approve' flag when running 'terraform apply'.\n\n" +
"It supports '--deploy-run-init=true|false' flag to enable/disable running terraform init before executing the command.\n\n" +
"It supports '--from-plan' flag. If the flag is specified, the command will use the planfile previously generated by 'atmos terraform plan' " +
"command instead of generating a new planfile.\nNote that in this case, the planfile name is in the format supported by Atmos and is " +
"saved to the component's folder.\n\n" +
"It supports '--planfile' flag to specify the path to a planfile.\nThe '--planfile' flag should be used instead of the 'planfile' " +
"argument in the native 'terraform apply <planfile>' command.\n\n" +
"For more details refer to https://atmos.tools/cli/commands/terraform/deploy\n")
} else if componentType == "terraform" && command == "shell" {
u.PrintMessage("\n'atmos terraform shell' command starts a new SHELL configured with the environment for an Atmos component " +
"in a Stack to allow executing all native terraform commands\ninside the shell without using the atmos-specific arguments and flags.\n\n" +
"Usage: atmos terraform shell <component> -s <stack>\n\n" +
"The command does the following:\n\n" +
" - Processes the stack config files, generates the required variables for the Atmos component in the stack, and writes them to a file in the component's folder\n" +
" - Generates a backend config file for the Atmos component in the stack and writes it to a file in the component's folder (or as specified by the Atmos configuration setting)\n" +
" - Creates a Terraform workspace for the component in the stack\n" +
" - Drops the user into a separate shell (process) with all the required paths and ENV vars set\n" +
" - Inside the shell, the user can execute all Terraform commands using the native syntax\n\n" +
"For more details refer to https://atmos.tools/cli/commands/terraform/shell\n")
} else if componentType == "terraform" && command == "workspace" {
u.PrintMessage("\n'atmos terraform workspace' command calculates the Terraform workspace for an Atmos component,\n" +
"and then executes 'terraform init -reconfigure' and selects the Terraform workspace by executing the 'terraform workspace select' command.\n" +
"If the workspace does not exist, the command creates it by executing the 'terraform workspace new' command.\n\n" +
"Usage: atmos terraform workspace <component> -s <stack>\n\n" +
"For more details refer to https://atmos.tools/cli/commands/terraform/workspace\n")
} else {
u.PrintMessage(fmt.Sprintf("\nAtmos supports native '%s' commands with all the options, arguments and flags.\n", componentType))
u.PrintMessage("In addition, 'component' and 'stack' are required in order to generate variables for the component in the stack.\n")
Expand Down

0 comments on commit 84a1033

Please sign in to comment.