-
Notifications
You must be signed in to change notification settings - Fork 3
fix(cli_tools): Enclose option help in quotes #77
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
Conversation
In the carapace yaml generator, ensure the option help text is formatted with quotes/escapes to that it is correct yaml format.
📝 WalkthroughWalkthroughAdds a private Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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)
packages/cli_tools/lib/src/better_command_runner/completion/carapace_generator.dart (1)
123-132: Consider reusing the outeroptionHelpvariable.The
optionHelpvariable is redeclared on line 125 with the same expression as line 116, both formattingoption.helpText. Since the outeroptionHelpis already in scope, you can eliminate this duplication.Apply this diff to reuse the outer variable:
if (option case final FlagOption flagOption) { if (flagOption.negatable && !flagOption.hideNegatedUsage) { - final optionHelp = _formatYamlStringValue(option.helpText ?? ''); _writeWithIndent( out, '--no-${option.argName}$attributes: $optionHelp', indentLevel, ); } }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
packages/cli_tools/lib/src/better_command_runner/completion/carapace_generator.dart(2 hunks)packages/cli_tools/test/better_command_runner/completion_test.dart(1 hunks)
🔇 Additional comments (4)
packages/cli_tools/lib/src/better_command_runner/completion/carapace_generator.dart (2)
197-201: LGTM! Correct escaping order.The implementation properly escapes backslashes before quotes, which is essential to avoid double-escaping issues. The method correctly wraps the result in double quotes to produce valid YAML string values.
116-119: LGTM! Proper YAML string formatting applied.The help text is now correctly formatted as a quoted YAML string value, ensuring valid YAML output even when help text contains special characters.
packages/cli_tools/test/better_command_runner/completion_test.dart (2)
156-157: LGTM! Test expectations correctly updated.The persistent flag descriptions are now properly quoted, matching the new YAML string formatting behavior from the generator.
163-165: LGTM! Flag descriptions correctly updated.The flag help text is now properly quoted in the test expectations, consistent with the YAML string formatting applied by the generator.
nielsenko
left a comment
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.
I suggest handling \t, \n, and \r as well.
packages/cli_tools/lib/src/better_command_runner/completion/carapace_generator.dart
Show resolved
Hide resolved
packages/cli_tools/lib/src/better_command_runner/completion/carapace_generator.dart
Outdated
Show resolved
Hide resolved
nielsenko
left a comment
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.
LGTM 🚀
In the carapace yaml generator, ensure the option help text is formatted with quotes/escapes to that it is correct yaml format.
Summary by CodeRabbit
Bug Fixes
Tests