fix: correct usage in server cmd#371
Conversation
We've renamed the control plane server binary to `pgedge-control-plane`. This commit fixes the usage information that you get from the server's inline help, e.g.: ```sh go run ./server --help ```
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
📝 WalkthroughWalkthroughThe CLI root command's usage name was updated from Changes
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 60 minutes.Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
server/cmd/root.go (1)
46-52: Usecmd.Name()instead ofcmd.Usefor the version skip.For correctness/robustness, prefer
cmd.Name() == "version"(identity of the command) overcmd.Use(which is presentation/usage text and can be formatted).Proposed change
- if cmd.Use == "version" { + if cmd.Name() == "version" { // Skip initialization for the version command. return nil }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@server/cmd/root.go` around lines 46 - 52, In PersistentPreRunE (the function that sets cmd.SilenceUsage), replace the version check that currently uses cmd.Use with cmd.Name() — i.e., change the condition from if cmd.Use == "version" to if cmd.Name() == "version" — so the "version" command skip uses the command identity; leave the surrounding logic (cmd.SilenceUsage = true and the early return) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@server/cmd/root.go`:
- Around line 46-52: In PersistentPreRunE (the function that sets
cmd.SilenceUsage), replace the version check that currently uses cmd.Use with
cmd.Name() — i.e., change the condition from if cmd.Use == "version" to if
cmd.Name() == "version" — so the "version" command skip uses the command
identity; leave the surrounding logic (cmd.SilenceUsage = true and the early
return) unchanged.
Summary
We've renamed the control plane server binary to
pgedge-control-plane. This commit fixes the usage information that you get from the server's inline help.Testing
# this changes the 'Usage' section in the inline help to say pgedge-control-plane: go run ./server --help