-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix(client/v2): correctly handle enhanced sub commands #21809
base: main
Are you sure you want to change the base?
Conversation
WalkthroughWalkthroughThe changes in this pull request introduce conditional checks in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant CommandDescriptor
User->>CLI: Request command
CLI->>CommandDescriptor: Check EnhanceCustomCommand
alt EnhanceCustomCommand is false
CLI->>CLI: Add command to parent
else EnhanceCustomCommand is true
CLI->>CLI: Do not add command
end
Recent review detailsConfiguration used: .coderabbit.yml Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
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
Outside diff range and nitpick comments (1)
client/v2/autocli/query.go (1)
56-58
: Conditional check for adding subcommands based onEnhanceCustomCommand
flag.The introduced conditional check allows for selective inclusion of subcommands based on the
EnhanceCustomCommand
property. IfEnhanceCustomCommand
istrue
, the subcommand will not be automatically added to the command. This change provides more control over the CLI commands and allows for customization.Consider adding a comment to clarify the intention behind the
EnhanceCustomCommand
flag and its impact on command registration.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- client/v2/autocli/msg.go (1 hunks)
- client/v2/autocli/query.go (1 hunks)
Additional context used
Path-based instructions (2)
client/v2/autocli/query.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/v2/autocli/msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (1)
client/v2/autocli/query.go (1)
Line range hint
1-200
: Code conforms to the Uber Golang style guide.The Golang code follows the naming conventions, formatting, and code structure recommended by the Uber Golang style guide. The package naming and import grouping adhere to the guidelines. The code also follows the recommended error handling and return practices.
client/v2/autocli/msg.go
Outdated
if !subCmdDesc.EnhanceCustomCommand { | ||
cmd.AddCommand(subCmd) | ||
} |
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.
The conditional check alters the command registration behavior.
This change introduces a gate that conditionally adds the subCmd
to the parent cmd
based on the EnhanceCustomCommand
property of the subCmdDesc
descriptor. Commands will only be included if EnhanceCustomCommand
is false.
Consider adding documentation or comments to clarify:
- The purpose and effect of the
EnhanceCustomCommand
property. - How this change impacts the CLI user experience, as certain commands may not be available based on this setting.
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.
Could we add a comment on this? This makes sense to respect the EnhanceCustomCommand
on subcommands too but let's be explicit with a comment.
Any way we could capture this in a test? (see query_test.go
)
Should I work on this, or @JulianToledano? |
You can do it if you can. Assignees are for PR reviews. If you can't, then we'll do it. |
Description
When attempting to enhance sub commands, AutoCLI would be adding two sub commands to the main command.
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit