-
-
Notifications
You must be signed in to change notification settings - Fork 111
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
Fixes multiple help issues #959
base: main
Are you sure you want to change the base?
Fixes multiple help issues #959
Conversation
b1741d5
to
01bcd67
Compare
tests/snapshots/TestCLICommands_atmos_non-existent.stderr.golden
Outdated
Show resolved
Hide resolved
018793e
to
b8a0fb9
Compare
b8a0fb9
to
bb9705b
Compare
tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden
Outdated
Show resolved
Hide resolved
@samtholiya please resolve the conflicts and address the comments |
dev-2953-update-help-and-usageyaml-with-snapshots
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cmd/cmd_utils.go (1)
121-148
: Add validation for empty alias and parts.The function handles command hierarchy well, but could benefit from additional validation.
Apply this diff to improve input validation:
func addCommandWithAlias(parentCmd *cobra.Command, alias string, parts []string) { + if alias == "" { + u.LogErrorAndExit(fmt.Errorf("empty alias provided")) + } if len(parts) == 0 { return } + if parts[0] == "" { + u.LogErrorAndExit(fmt.Errorf("empty command part in alias `%s`", alias)) + }
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
cmd/cmd_utils.go
(5 hunks)cmd/terraform.go
(2 hunks)internal/exec/vendor_utils.go
(2 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
- internal/exec/vendor_utils.go
- cmd/terraform.go
🧰 Additional context used
📓 Learnings (1)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
🪛 golangci-lint (1.62.2)
cmd/cmd_utils.go
673-673: printf: non-constant format string in call to fmt.Errorf
(govet)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (2)
cmd/cmd_utils.go (2)
589-674
: Well-structured error handling with markdown support!The error handling implementation is clean and consistent, with good use of markdown for improved readability.
🧰 Tools
🪛 golangci-lint (1.62.2)
673-673: printf: non-constant format string in call to fmt.Errorf
(govet)
673-673
: 🛠️ Refactor suggestionFix non-constant format string in fmt.Errorf.
The static analysis tool correctly flags the use of a non-constant format string.
Apply this diff to fix the warning:
- u.PrintErrorMarkdownAndExit("Incorrect Usage", fmt.Errorf(details), suggestion) + u.PrintErrorMarkdownAndExit("Incorrect Usage", errors.New(details), suggestion)Likely invalid or redundant comment.
🧰 Tools
🪛 golangci-lint (1.62.2)
673-673: printf: non-constant format string in call to fmt.Errorf
(govet)
c38a423
to
316fc49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (5)
internal/tui/templates/help_printer.go (1)
106-109
: LGTM! The condition prevents default values for double dash flags.The implementation correctly handles the double dash flag case by checking for empty flag names. This aligns with the PR objectives to improve help output clarity.
Consider adding validation for edge cases:
// if Name is empty it is our double dash. -if flag.DefValue != "" && flag.Name != "" { +if flag.DefValue != "" && flag.Name != "" && strings.TrimSpace(flag.Name) != "" { description = fmt.Sprintf("%s (default %q)", description, flag.DefValue) }pkg/utils/markdown_utils.go (3)
18-19
: Consider concurrency safeguards for the global renderer.
If multiple goroutines invoke these utils simultaneously, consider synchronizing access to the globalrender
to prevent race conditions.
49-65
: Return after logging write errors.
Currently, the code logs any error writing to stderr but does not exit or return. Consider returning after logging to avoid proceeding with partial error output.
76-91
: Consider return on write failure.
Similar toPrintfErrorMarkdown
, returning after an error would prevent further actions when stdout writes fail.tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (1)
95-95
: Unify dash usage in the example section.
You appear to have used an en dash (–) instead of a plain hyphen (-). Consider standardizing.-– Execute a terraform +- Execute a terraform
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (23)
cmd/cmd_utils.go
(5 hunks)cmd/list_components.go
(1 hunks)cmd/list_workflows.go
(1 hunks)cmd/terraform.go
(2 hunks)go.mod
(1 hunks)internal/tui/templates/help_printer.go
(1 hunks)pkg/utils/markdown_utils.go
(1 hunks)pkg/version/version.go
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden
(1 hunks)tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- pkg/version/version.go
🚧 Files skipped from review as they are similar to previous changes (17)
- tests/snapshots/TestCLICommands_atmos_terraform_apply_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_atlantis_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_terraform_apply_--help.stdout.golden
- cmd/list_workflows.go
- tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_helmfile_apply_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_atlantis_generate_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_atlantis_generate_repo-config_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_atlantis_generate_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_helmfile_--help.stdout.golden
- cmd/terraform.go
- tests/snapshots/TestCLICommands_atmos_atlantis_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_helmfile_apply_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_helmfile_help.stdout.golden
- cmd/list_components.go
- tests/snapshots/TestCLICommands_atmos_terraform_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_terraform_--help_alias_subcommand_check.stdout.golden
🧰 Additional context used
📓 Learnings (1)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (17)
go.mod (1)
61-61
: Explicitly requiringgolang.org/x/text
as a direct dependency.This change moves the
golang.org/x/text v0.21.0
module from an indirect to a direct requirement. It makes it clear that the module is actively used in the project (likely for enhanced markdown rendering and error formatting in light of the PR objectives). Please ensure any related documentation or usage in the code reflects this direct dependency.pkg/utils/markdown_utils.go (5)
1-2
: Documented package purpose well.
Clear and concise introduction to the package's responsibility.
21-47
: Handling of stack trace is consistent.
If configured for debug, printing the stack helps with troubleshooting. This logic looks good.
67-70
: Simple exit pattern is valid.
Exits immediately after printing error markdown, aligning with fail-fast behavior.
72-74
: Invalid usage is handled correctly.
Nicely leverages existing markdown printing for a consistent error message.
93-99
: Initialization logic is correct.
Fails fast if markdown renderer cannot be created, ensuring no half-initialized state.tests/snapshots/TestCLICommands_atmos_terraform_help.stdout.golden (4)
2-3
: Usage description is clear.
Gives context about Terraform commands and how they integrate with Atmos.
6-48
: Command references look consistent.
All sub-commands and native Terraform commands are correctly listed.
51-63
: Flags documentation is thorough.
Properly explains how users can customize behavior.
73-80
: Global flags are detailed.
Well-described logging and redirection settings.cmd/cmd_utils.go (7)
49-53
: Alias mapping looks good.
The iteration over command aliases is concise and straightforward.
121-148
: Fail-fast approach is consistent with prior learnings.
This function enforces correctness by exiting when a subcommand is unavailable, which prevents unexpected behavior.
224-226
: Clear handling of invalid command scenario.
Exits with Markdown-based error, ensuring user feedback.
590-599
: Usage fallback is user-friendly.
Graceful fallback to show usage or relevant subcommands is well-executed.
601-614
: Flag error usage pathway is consistent.
Generates a descriptive error and exits. This matches the rest of the CLI's fail-fast behavior.
637-664
: Helpful subcommand suggestions.
Logic for displaying valid subcommands or suggestions is robust.
666-674
: Markdown usage examples are integrated strongly.
Provides a clear fallback and custom usage examples if available.
There was a problem hiding this 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/cmd_utils.go (1)
224-226
: Simplify error creation using fmt.Errorf.The current error creation can be simplified for better readability.
Apply this diff:
- u.PrintErrorMarkdownAndExit("Invalid command", errors.New( - fmt.Sprintf("no args, no steps, no sub-commands provided in config for `%s`", cmd.CommandPath()), - ), "https://atmos.tools/cli/configuration/commands") + u.PrintErrorMarkdownAndExit("Invalid command", + fmt.Errorf("no args, no steps, no sub-commands provided in config for `%s`", cmd.CommandPath()), + "https://atmos.tools/cli/configuration/commands")🧰 Tools
🪛 golangci-lint (1.62.2)
224-224: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
pkg/ui/markdown/renderer.go (1)
137-137
: Simplify string formatting.The
fmt.Sprintf
is unnecessary when the argument is already a string.- content += fmt.Sprintf("%s", details) + content += details🧰 Tools
🪛 golangci-lint (1.62.2)
137-137: S1025: the argument is already a string, there's no need to use fmt.Sprintf
(gosimple)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cmd/cmd_utils.go
(5 hunks)pkg/ui/markdown/renderer.go
(5 hunks)
🧰 Additional context used
📓 Learnings (1)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
🪛 golangci-lint (1.62.2)
pkg/ui/markdown/renderer.go
20-20: field atmosConfig
is unused
(unused)
137-137: S1025: the argument is already a string, there's no need to use fmt.Sprintf
(gosimple)
cmd/cmd_utils.go
224-224: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (4)
cmd/cmd_utils.go (2)
121-148
: LGTM! Well-structured command alias handling.The recursive implementation for building command hierarchies is clean and efficient. The early return and proper error handling align with the CLI's fail-fast philosophy.
589-674
: LGTM! User-friendly help and usage display.The implementation provides excellent user experience with:
- Markdown-formatted usage examples
- Command suggestions
- Clear subcommand listings
pkg/ui/markdown/renderer.go (2)
16-21
: LGTM! Constructor changes look good.The addition of
atmosConfig
and its integration into the constructor enhances the renderer's configurability.Also applies to: 23-55
🧰 Tools
🪛 golangci-lint (1.62.2)
20-20: field
atmosConfig
is unused(unused)
180-195
: LGTM! Robust terminal width handling.The implementation properly handles type assertion failures and provides appropriate fallbacks, addressing previous concerns about nil pointer issues.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
tests/test-cases/complete.yaml (1)
18-35
: Clarify Test Case Description foratmos workflow pla --file workflow1
The new test case is well structured and correctly captures the expected output (error messages and exit code 1). However, the description ("Ensure atmos workflow pla --file workflow1 runs successfully") might be a bit misleading since the command is intended to trigger an error state (exit code 1). Consider updating the description to reflect that the command is handling a missing workflow scenario.
tests/fixtures/scenarios/complete/atmos.yaml (1)
246-248
: Refine Invalid Command ConfigurationA new command entry for
invalidCommand
is added. The configuration correctly omits any steps or subcommands, which will trigger the enhanced error messaging. For improved clarity and grammar, consider rephrasing the description to:
"This is an invalid command that has neither steps nor a subcommand configured"
This minor change will improve readability.cmd/cmd_utils.go (1)
224-226
: Simplify error creation using fmt.Errorf.The error creation can be simplified by using
fmt.Errorf
directly instead of wrappingfmt.Sprintf
witherrors.New
.Apply this diff to simplify the error creation:
- u.PrintErrorMarkdownAndExit("Invalid command", errors.New( - fmt.Sprintf("The `%s` command has no steps or subcommands configured.", cmd.CommandPath()), - ), "https://atmos.tools/cli/configuration/commands") + u.PrintErrorMarkdownAndExit("Invalid command", + fmt.Errorf("The `%s` command has no steps or subcommands configured.", cmd.CommandPath()), + "https://atmos.tools/cli/configuration/commands")🧰 Tools
🪛 golangci-lint (1.62.2)
224-224: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
cmd/cmd_utils.go
(5 hunks)tests/fixtures/scenarios/complete/atmos.yaml
(1 hunks)tests/snapshots/TestCLICommands_atmos_invalidCommand.stderr.golden
(1 hunks)tests/test-cases/complete.yaml
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/snapshots/TestCLICommands_atmos_invalidCommand.stderr.golden
🧰 Additional context used
📓 Learnings (1)
cmd/cmd_utils.go (2)
Learnt from: samtholiya
PR: cloudposse/atmos#914
File: cmd/root.go:172-178
Timestamp: 2025-01-18T15:18:35.475Z
Learning: The `showUsageAndExit` function in `cmd/cmd_utils.go` provides user feedback by showing error messages, command suggestions, and valid subcommands before terminating the program with `os.Exit(1)`. It never returns to the caller, making error handling unnecessary for calls to this function.
Learnt from: samtholiya
PR: cloudposse/atmos#959
File: cmd/cmd_utils.go:121-148
Timestamp: 2025-02-03T05:57:18.407Z
Learning: The Atmos CLI should fail fast (exit) when encountering configuration errors, including command alias configuration issues, to prevent undefined behavior. Use LogErrorAndExit instead of returning errors in such cases.
🪛 golangci-lint (1.62.2)
cmd/cmd_utils.go
224-224: S1028: should use fmt.Errorf(...) instead of errors.New(fmt.Sprintf(...))
(gosimple)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (3)
tests/test-cases/complete.yaml (1)
36-48
: Validate Invalid Command Test CaseThe test case for
atmos invalidCommand
clearly verifies that an unknown command returns the expected error message ("command has no steps or subcommands configured") and exit code 1. This aligns with the updated error handling logic in the CLI.cmd/cmd_utils.go (2)
49-53
: Well-structured command alias implementation!The command alias handling is implemented with proper validation and follows the fail-fast principle for configuration errors. The recursive approach for building command hierarchies is clean and maintainable.
Also applies to: 121-148
589-674
: Excellent user-friendly error handling!The implementation provides a great user experience with:
- Intelligent command suggestions
- Clear listing of valid subcommands
- Markdown-formatted usage examples
- Contextual error messages
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cmd/root.go (1)
21-22
: Consider consolidating utils imports.You have two imports of the same package:
"github.com/cloudposse/atmos/pkg/utils" u "github.com/cloudposse/atmos/pkg/utils"Consider using just one import to reduce confusion:
-"github.com/cloudposse/atmos/pkg/utils" -u "github.com/cloudposse/atmos/pkg/utils" +u "github.com/cloudposse/atmos/pkg/utils"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
cmd/root.go
(4 hunks)tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
(3 hunks)tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden
(2 hunks)tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden
(2 hunks)tests/test-cases/log-level-validation.yaml
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
- tests/snapshots/TestCLICommands_atmos_validate_editorconfig_help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_--help.stdout.golden
- tests/snapshots/TestCLICommands_atmos_validate_editorconfig_--help.stdout.golden
- tests/test-cases/log-level-validation.yaml
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: [mock-windows] tests/fixtures/scenarios/complete
- GitHub Check: Acceptance Tests (macos-latest, macos)
- GitHub Check: Acceptance Tests (windows-latest, windows)
- GitHub Check: Acceptance Tests (ubuntu-latest, linux)
- GitHub Check: [localstack] demo-localstack
- GitHub Check: Summary
🔇 Additional comments (3)
cmd/root.go (3)
79-79
: LGTM! Consistent error handling with markdown support.The change from
LogErrorAndExit
toPrintErrorMarkdownAndExit
aligns with the PR objective of standardizing error handling with markdown support.
138-138
: LGTM! Markdown initialization added.The addition of
utils.InitializeMarkdown(atmosConfig)
supports the PR objective of improving help output with markdown rendering.
215-217
: LGTM! Enhanced flag error handling.The new
SetFlagErrorFunc
implementation improves user guidance for invalid flag usage, which aligns with the PR objectives.
@samtholiya please address the comment. Also, please update the
It's a big PR, and just saying "We would be fixing multiple UX issues" does not help to understand what is being fixed and why. When we create a new release, we could not just say "We would be fixing multiple UX issues with help in this release", we would need a better |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
cmd/root.go (1)
21-22
: Consider consolidating duplicate package imports.You're importing the same package twice with different aliases. Consider using just one import with the alias
u
since it's already being used throughout the code.- "github.com/cloudposse/atmos/pkg/utils" u "github.com/cloudposse/atmos/pkg/utils"
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
cmd/root.go
(4 hunks)go.mod
(1 hunks)tests/test-cases/log-level-validation.yaml
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- tests/test-cases/log-level-validation.yaml
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Build (windows-latest, windows)
- GitHub Check: Summary
🔇 Additional comments (4)
go.mod (1)
61-61
: Direct Dependency on golang.org/x/text Established.
This change removes the "indirect" annotation, making golang.org/x/text a direct dependency. This is likely necessary to support the updated markdown rendering in help and error messages. Please ensure that all module usages related to text processing have been aligned with this update and verify there are no dependency conflicts.cmd/root.go (3)
81-81
: LGTM! Enhanced error handling with markdown support.The change from
LogErrorAndExit
toPrintErrorMarkdownAndExit
aligns with the PR's objective to improve error message readability.
268-270
: LGTM! Improved flag error handling.The addition of a dedicated flag error handler using
showFlagUsageAndExit
enhances the user experience by providing better guidance for invalid flag usage.
176-176
: Verify markdown initialization timing.The markdown initialization is placed after error checking. Please ensure that any code paths that might use markdown features before this point are properly handled.
✅ Verification successful
🏁 Script executed:
#!/bin/bash # Search for markdown-related function calls that might execute before initialization rg -p "PrintErrorMarkdown|RenderMarkdown" | grep -B 5 "InitializeMarkdown" || echo "No early markdown usage found"Length of output: 143
Markdown Initialization Timing Verified
The shell script search confirms there are no markdown function calls (such as PrintErrorMarkdown or RenderMarkdown) occurring before the call to utils.InitializeMarkdown. Therefore, the initialization appears to be correctly placed.
what
We would be fixing the following UX issues with help in this pr:
atmos about non-existent
should show usage:Double dash in flags of
![image](https://private-user-images.githubusercontent.com/11261548/410619143-2392ce36-293b-4d4e-8ae3-561046fc809d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MTA2MTkxNDMtMjM5MmNlMzYtMjkzYi00ZDRlLThhZTMtNTYxMDQ2ZmM4MDlkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI4MDQ5ZjZiMWRjNWRhNjg4MjNmNDk3ODhlNzBjZDUzNWQ5OWE4ZjEzYWExMzAyOTFjYzEyNjY5YTY5NmUwODAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.KclYiiOKeb9GQfYTEdCCs-XoEB0cf9r-Vfbw_ieomtM)
atmos terraform --help
and examples rendering using markdown if available.Fixed
![image](https://private-user-images.githubusercontent.com/11261548/406633135-62067c85-f09e-4d4a-a4e7-e6eadd3e1b28.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MDY2MzMxMzUtNjIwNjdjODUtZjA5ZS00ZDRhLWE0ZTctZTZlYWRkM2UxYjI4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFmZmNlZmY4NTI2YjVjOGUzZWFhZWQ5M2MyYTM1MDY0ZWMyZWY3ZGY3NzU5ZjE1MzM2ODJmMjhjZmYwZWIzNTAmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.30DVh1NhYvTidp004_g4ZpoHWr5KON5V5DXJuYH7kdk)
atmos workflow --file example.yaml
bug for markdown. Now it also exits with exit code 1.Updated Default error logger with markdown support.
![image](https://private-user-images.githubusercontent.com/11261548/410620719-14471235-416a-4b4d-95d1-b84588e8b9b7.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MTA2MjA3MTktMTQ0NzEyMzUtNDE2YS00YjRkLTk1ZDEtYjg0NTg4ZThiOWI3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTA4MGNhZTM3NjA0OGFhYzU2MDE3NzRiYWM4ZDEwODVjYmRjODk4MWM0ZTNkMGZhMTg0MzFlMGNjZjVmZDgwZWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.vtj8LoD5M6auUOESfZb5okP-u7K4ng0xXD7Hr80yF7g)
Added custom alias help support so that alias in config should also be displayed in help.
![image](https://private-user-images.githubusercontent.com/11261548/407532112-6866e0a4-5d8e-4631-9049-9f0a18048e38.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MDc1MzIxMTItNjg2NmUwYTQtNWQ4ZS00NjMxLTkwNDktOWYwYTE4MDQ4ZTM4LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTMxZjZhMjlhMDBkODQ2Y2I4YTY2YzEzOTA2NjQyNTdlMzg0ODc1MTI4MDEwNjI4YTM0NzFlMTE5MWNlZGM5M2EmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.EYwECjzLZxkuh0XW5cs7-O6wyr6EaJyG7vAtgKK8efI)
Updated the workflow name invalid UI
![image](https://private-user-images.githubusercontent.com/11261548/409773312-7b0ecaa6-edcd-4988-a5fc-68d7af39890c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MDk3NzMzMTItN2IwZWNhYTYtZWRjZC00OTg4LWE1ZmMtNjhkN2FmMzk4OTBjLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyZDZlYmJjMjAzOWE2NTZhYTMwOGJkZTBiMzMyNGE1ZmM2YjZlNDVkODFmMmY1NDRjNmU0OGUxYTQ4MTNhYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.W0_8sAipzMctxMgjXWGrmpmqaKOY2H0UlxqlnAiGGB8)
Invalid custom command config now shows better help
![image](https://private-user-images.githubusercontent.com/11261548/410622285-17c0fc94-180b-450f-b4bf-591690e8c862.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MTA2MjIyODUtMTdjMGZjOTQtMTgwYi00NTBmLWI0YmYtNTkxNjkwZThjODYyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTFhODQyYmZhN2IxZmE3ZDE3ZTQ0MjQ3NDRkOGFkNWQ0MzBmZWQxMWE5NjYzM2NhYjM4N2Q0ZmM5OGJkMWVkMjYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.xVcHz6FbZiFKeZK2MXhnbyDDaw8Jq1piPklVqODlsK0)
Invalid flag usage added
![image](https://private-user-images.githubusercontent.com/11261548/410196148-f9baed22-fa79-41da-9054-6a55a460b5c5.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDM4NjgsIm5iZiI6MTczOTA0MzU2OCwicGF0aCI6Ii8xMTI2MTU0OC80MTAxOTYxNDgtZjliYWVkMjItZmE3OS00MWRhLTkwNTQtNmE1NWE0NjBiNWM1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MzkyOFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWMxMGRhZDI0OGY3ZTA5MTAwODIwYjY4ZTljNjQzMWI4MjZmYzI5Y2JkNWQ0YzAwZTVhZTMzNjg4M2U1OGZiMzUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.FEyBhNjZ-IqfYRE0jUeP0yFwM6vjj7CeSZZNL6WagX0)
why
references
Summary by CodeRabbit
Summary by CodeRabbit
New Features
Enhancements
Documentation
Refactor