Show resource subcommands on --help, no-cmd, and unknown-cmd paths#261
Open
amaechiabuah wants to merge 4 commits into
Open
Show resource subcommands on --help, no-cmd, and unknown-cmd paths#261amaechiabuah wants to merge 4 commits into
amaechiabuah wants to merge 4 commits into
Conversation
Contributor
ⓘ You've reached your Qodo monthly free-tier limit. Reviews pause until next month — upgrade your plan to continue now, or link your paid account if you already have one. |
Contributor
Contributor
☂️ Python Coverage
Overall Coverage
New FilesNo new covered files... Modified Files
|
duplodavid
reviewed
Apr 30, 2026
Comment on lines
+7
to
+8
| if resource_help_intercept(sys.argv[1:]): | ||
| return |
Contributor
There was a problem hiding this comment.
Want to move this into the try below just in case this ever itself throws?
duplodavid
reviewed
Apr 30, 2026
Comment on lines
+459
to
+465
| lines = [f"Available commands for {name}:"] | ||
| for label, summary in entries: | ||
| if summary: | ||
| lines.append(f" {label.ljust(width)} {summary}") | ||
| else: | ||
| lines.append(f" {label}") | ||
| return "\n".join(lines) |
Contributor
There was a problem hiding this comment.
Want to add a fallback in case no entries under the name matched? Like: return f"No commands registered for {name}."
duplodavid
requested changes
Apr 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Describe Changes
Surfaces the registered
@Commandsubcommands of a resource in three CLI paths that previously hid them:duploctl <resource> --helpnow prints the resource's class docstring followed by its command listing (was: global flags only).duploctl <resource> <bad-cmd>now appends the available command list to theCommand X not found.error.duploctl <resource>(no subcommand) now appends the available command list under the resource docstring instead of falling through to a stack trace.Implementation:
format_resource_commands(name)andresource_help_intercept(argv)incommander.py. The intercept runs before argparse so--helpis no longer swallowed by the global parser.@Commandnow stores the function reference inschemaso docstrings render without re-importing the resource module.get_command_schemalooks up the resource name from the class MRO and appends the listing to the not-found error.controller.__call__'sTypeErrorbranch now appends the listing to the resource docstring (and drops the noisytraceback.print_exc()fallback).Link to Issues
https://app.clickup.com/t/8655600/DUPLO-14197
PR Review Checklist