Fixed the issue with knife -h command showing invalid subcommands - #88
Merged
Conversation
sanghinitin
approved these changes
Apr 20, 2026
nikhil2611
approved these changes
Apr 20, 2026
sanjain-progress
approved these changes
Apr 20, 2026
tpowell-progress
requested changes
Apr 21, 2026
tpowell-progress
left a comment
Collaborator
There was a problem hiding this comment.
Any tests or validation of this? I don't see example output from testing or anything.
Signed-off-by: Ashique Saidalavi <Ashique.saidalavi@progress.com>
Signed-off-by: Ashique Saidalavi <Ashique.saidalavi@progress.com>
ashiqueps
force-pushed
the
CHEF-33284-knife-h-shows-invalid-subcommands
branch
from
April 22, 2026 10:11
355d5c0 to
2fbf355
Compare
Contributor
Author
|
@tpowell-progress Added tests, please review. |
tpowell-progress
approved these changes
Apr 23, 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.
Description
The
knife -hcommand was showing invalid subcommands such asCOMMAND COMMAND,SERVER COMMAND,RESOURCE COMMAND, etc., which were coming from the subclasses.This PR updates the code to skip classes defined inside a subdirectory of the lib/chef/knife/ tree (e.g. lib/chef/knife/cloud/server/create_command.rb). By convention, real knife subcommands live directly at lib/chef/knife/.rb — the same flat pattern that GemGlobLoader uses when discovering commands. Abstract base classes from plugins like knife-cloud are nested in subdirs and are only loaded transitively; registering them causes spurious categories (e.g. ** SERVER COMMANDS **) to appear in 'knife --help'.
Related Issue
Types of changes
Checklist:
Gemfile.lockhas changed, I have used--conservativeto do it and included the full output in the Description above.