summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2019-10-08 09:11:15 -0700
committerGitHub <noreply@github.com>2019-10-08 09:11:15 -0700
commite36bcfe19135856d18e4c0485b0ea8e459e97141 (patch)
treebfea0a376897d48dc14892a49c98efb65e66a4ac
parentec949662794e769c0adde9b9157bf78ece1ad4c8 (diff)
parentb2fe1152aa6bc098da9cff742f2b59d604f5d79f (diff)
downloadchef-e36bcfe19135856d18e4c0485b0ea8e459e97141.tar.gz
Merge pull request #8915 from MsysTechnologiesllc/vasundhara/fix_knife_subcommands_help_command
Fix for knife subcommand --help don't work as intended.
-rw-r--r--lib/chef/knife.rb12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 28634d9e44..a17137de43 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -64,6 +64,12 @@ class Chef
attr_accessor :name_args
attr_accessor :ui
+ # knife acl subcommands are grouped in this category using this constant to verify.
+ OPSCODE_HOSTED_CHEF_ACCESS_CONTROL = %w{acl group user}.freeze
+
+ # knife opc subcommands are grouped in this category using this constant to verify.
+ CHEF_ORGANIZATION_MANAGEMENT = %w{opc}.freeze
+
# Configure mixlib-cli to always separate defaults from user-supplied CLI options
def self.use_separate_defaults?
true
@@ -270,7 +276,11 @@ class Chef
ui.info("If this is a recently installed plugin, please run 'knife rehash' to update the subcommands cache.")
end
- if category_commands = guess_category(args)
+ if CHEF_ORGANIZATION_MANAGEMENT.include?(args[0])
+ list_commands("CHEF ORGANIZATION MANAGEMENT")
+ elsif OPSCODE_HOSTED_CHEF_ACCESS_CONTROL.include?(args[0])
+ list_commands("OPSCODE HOSTED CHEF ACCESS CONTROL")
+ elsif category_commands = guess_category(args)
list_commands(category_commands)
elsif OFFICIAL_PLUGINS.include?(args[0]) # command was an uninstalled official chef knife plugin
ui.info("Use `#{Chef::Dist::EXEC} gem install knife-#{args[0]}` to install the plugin into ChefDK")