summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Smith <tsmith@chef.io>2018-05-30 20:37:17 -0700
committerTim Smith <tsmith@chef.io>2018-05-30 20:37:17 -0700
commit6ca2263ce47bec67f6b4aebeab5b72109463d98b (patch)
treef7a34fc87b9db86a63886d80a840b1dd75e737bf
parent93786933a816ade48682b4256e7f14bfea016c2c (diff)
downloadchef-6ca2263ce47bec67f6b4aebeab5b72109463d98b.tar.gz
Avoid some unnecessary complexityofficial_knife_plugins
We already know the plugin name so there's no need to use find in order to return the plugin name. Signed-off-by: Tim Smith <tsmith@chef.io>
-rw-r--r--lib/chef/knife.rb6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/knife.rb b/lib/chef/knife.rb
index 146f7101be..79fdaafd9d 100644
--- a/lib/chef/knife.rb
+++ b/lib/chef/knife.rb
@@ -271,9 +271,9 @@ class Chef
if category_commands = guess_category(args)
list_commands(category_commands)
- elsif missing_plugin = ( OFFICIAL_PLUGINS.find { |plugin| plugin == args[0] } )
- ui.info("You can install the plugin with `(sudo) gem install knife-#{missing_plugin}`")
- ui.info("Use `chef gem install knife-#{missing_plugin}` instead if using ChefDK")
+ elsif OFFICIAL_PLUGINS.include?(args[0]) # command was an uninstalled official chef knife plugin
+ ui.info("You can install the plugin with `(sudo) gem install knife-#{args[0]}`")
+ ui.info("Use `chef gem install knife-#{args[0]}` instead if using ChefDK")
else
list_commands
end