Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge atmos specific and terraform help documentation #857

Conversation

samtholiya
Copy link
Collaborator

@samtholiya samtholiya commented Dec 14, 2024

what

Current:
image

After this change :
image


image

  • Merge help for terraform and atmos
  • Updated tab mechanism
  • Fade out not supported commands

why

  • We want to help customers show both native terraform commands and atmos terraform commands

references

Summary by CodeRabbit

  • New Features

    • Enhanced help command output with a styled logo for the "atmos" command.
    • Improved error handling and user feedback for the terraform command.
    • Introduced a comprehensive set of Terraform commands with detailed descriptions and examples.
    • Dynamic generation of help documentation based on command properties.
    • Enhanced command formatting capabilities to indicate unsupported commands.
    • Updated version of the Atmos CLI in the GitHub Actions workflow.
  • Bug Fixes

    • Simplified help output for "terraform" commands to reduce clutter.
    • Removed automatic update checks from help command execution.
  • Documentation

    • Updated command descriptions for clarity and detail.
    • Updated the version of the Atmos CLI in the Dockerfile.
  • Refactor

    • Improved command formatting and usage templates for better representation of command availability.
    • Streamlined control flow during help command execution.
    • Updated dependency versions in the project.

@osterman
Copy link
Member

I wonder why your terminal is not in color

@osterman
Copy link
Member

osterman commented Dec 15, 2024

Oh, I see now I didn't realize we were not using cobra's built-in mechanism.

Can you check why we are not using that because that means we have a very different implementation for this one off command!

I like what you're doing more than what we had. However, it looks nothing like atmos --help

@osterman
Copy link
Member

Is the current wrapping okay? (i don't think so but because the ticket mentions we want a simple solution)

We have solved the wrapping issues in Cobra, so if we can get the menu back in there, that would be ideal.

@mergify mergify bot added the triage Needs triage label Dec 17, 2024
@samtholiya samtholiya force-pushed the feature/dev-2821-atmos-terraform-help-should-also-show-terraform-help branch from 0fe021a to 4379eda Compare December 17, 2024 20:38
@osterman osterman removed the triage Needs triage label Dec 18, 2024
@mergify mergify bot added the triage Needs triage label Dec 18, 2024
@osterman osterman removed the triage Needs triage label Dec 18, 2024
@mergify mergify bot added the triage Needs triage label Dec 18, 2024
@osterman osterman added minor New features that do not break anything and removed triage Needs triage labels Dec 18, 2024
Copy link

mergify bot commented Dec 18, 2024

💥 This pull request now has conflicts. Could you fix it @samtholiya? 🙏

@mergify mergify bot added the conflict This PR has conflicts label Dec 18, 2024
@samtholiya samtholiya force-pushed the feature/dev-2821-atmos-terraform-help-should-also-show-terraform-help branch 2 times, most recently from b4b103a to 26d25fd Compare December 19, 2024 09:12
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 2, 2025
@aknysh
Copy link
Member

aknysh commented Jan 2, 2025

@samtholiya thanks

The tests are failing (looks like they all can't find the CLI flags), please look into that.

@samtholiya samtholiya force-pushed the feature/dev-2821-atmos-terraform-help-should-also-show-terraform-help branch from 832b8f1 to ea2732f Compare January 5, 2025 20:19
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
cmd/root.go (2)

125-141: Refactor duplicate logo printing logic.

The logo printing logic is duplicated in both conditional branches. Consider refactoring to improve maintainability:

 RootCmd.SetHelpFunc(func(command *cobra.Command, strings []string) {
     fmt.Println()
+    err := tuiUtils.PrintStyledText("ATMOS")
+    if err != nil {
+        u.LogErrorAndExit(atmosConfig, err)
+    }
+
     if command.Use != "atmos" {
-        err := tuiUtils.PrintStyledText("ATMOS")
-        if err != nil {
-            u.LogErrorAndExit(atmosConfig, err)
-        }
         if err := oldUsageFunc(command); err != nil {
             u.LogErrorAndExit(atmosConfig, err)
         }
     } else {
-        err := tuiUtils.PrintStyledText("ATMOS")
-        if err != nil {
-            u.LogErrorAndExit(atmosConfig, err)
-        }
         b.HelpFunc(command, strings)
         if err := command.Usage(); err != nil {
             u.LogErrorAndExit(atmosConfig, err)
         }
     }

143-143: Consider moving update check earlier.

The update check is performed after help display, which might delay the primary help information. Consider moving it before the help display to maintain focus on the help content.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 80c4b8a and 9184a73.

📒 Files selected for processing (2)
  • cmd/cmd_utils.go (0 hunks)
  • cmd/root.go (2 hunks)
💤 Files with no reviewable changes (1)
  • cmd/cmd_utils.go
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: [localstack] demo-localstack
  • GitHub Check: Acceptance Tests (windows-latest, windows)
  • GitHub Check: Summary
🔇 Additional comments (2)
cmd/root.go (2)

84-84: LGTM! Clean error handling setup.

The error variable declaration follows Go conventions and is well-scoped for the subsequent error handling blocks.


113-113: Great function renaming!

The rename from initConfig() to initCobraConfig() better reflects the function's specific responsibility of initializing Cobra configurations.

cmd/root.go Outdated Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Jan 7, 2025
aknysh
aknysh previously approved these changes Jan 7, 2025
@aknysh aknysh dismissed stale reviews from coderabbitai[bot] and themself via e1b0146 January 7, 2025 15:58
Copy link

mergify bot commented Jan 7, 2025

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@aknysh aknysh merged commit 851ae56 into main Jan 7, 2025
47 checks passed
@aknysh aknysh deleted the feature/dev-2821-atmos-terraform-help-should-also-show-terraform-help branch January 7, 2025 16:14
@mergify mergify bot removed the needs-cloudposse Needs Cloud Posse assistance label Jan 7, 2025
Copy link

github-actions bot commented Jan 7, 2025

These changes were released in v1.137.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor New features that do not break anything
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants