From 561e65ec72b05f1056624a70c62b8f1d39ca9b75 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 5 Jan 2014 21:16:41 -0800 Subject: [PATCH] commands/plugin: list shows version constraints and entrypoints --- .../commands/plugin/action/list_plugins.rb | 23 ++++++++++++++++++- templates/locales/en.yml | 2 ++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/plugins/commands/plugin/action/list_plugins.rb b/plugins/commands/plugin/action/list_plugins.rb index 76ad5a561..8a8ecd312 100644 --- a/plugins/commands/plugin/action/list_plugins.rb +++ b/plugins/commands/plugin/action/list_plugins.rb @@ -16,15 +16,36 @@ module VagrantPlugins end def call(env) - specs = Vagrant::Plugin::Manager.instance.installed_specs + manager = Vagrant::Plugin::Manager.instance + plugins = manager.installed_plugins + specs = manager.installed_specs # Output! if specs.empty? env[:ui].info(I18n.t("vagrant.commands.plugin.no_plugins")) + return @app.call(env) end specs.each do |spec| env[:ui].info "#{spec.name} (#{spec.version})" + + # Grab the plugin. Note that the check for whether it exists + # shouldn't be necessary since installed_specs checks that but + # its nice to be certain. + plugin = plugins[spec.name] + next if !plugin + + if plugin["gem_version"] && plugin["gem_version"] != "" + env[:ui].info(I18n.t( + "vagrant.commands.plugin.plugin_version", + version: plugin["gem_version"])) + end + + if plugin["require"] && plugin["require"] != "" + env[:ui].info(I18n.t( + "vagrant.commands.plugin.plugin_require", + require: plugin["require"])) + end end @app.call(env) diff --git a/templates/locales/en.yml b/templates/locales/en.yml index c8c900375..a80e8cb7f 100644 --- a/templates/locales/en.yml +++ b/templates/locales/en.yml @@ -919,6 +919,8 @@ en: Installing license for '%{name}'... no_plugins: |- No plugins installed. + plugin_require: " - Custom entrypoint: %{require}" + plugin_version: " - Version Constraint: %{version}" installed: |- Installed the plugin '%{name} (%{version})'! installing: |-