lib/nanoc/cli/commands/show-plugins.rb in nanoc-4.7.9 vs lib/nanoc/cli/commands/show-plugins.rb in nanoc-4.7.10
- old
+ new
@@ -1,11 +1,13 @@
+# frozen_string_literal: true
+
summary 'show all available plugins'
aliases :info
usage 'show-plugins [options]'
-description <<-EOS
-Show a list of available plugins, including filters and data sources.
-If the current directory contains a Nanoc web site, the plugins defined in this site will be shown as well.
+description <<~EOS
+ Show a list of available plugins, including filters and data sources.
+ If the current directory contains a Nanoc web site, the plugins defined in this site will be shown as well.
EOS
module Nanoc::CLI::Commands
class ShowPlugins < ::Nanoc::CLI::CommandRunner
def run
@@ -14,10 +16,10 @@
raise Nanoc::Int::Errors::GenericTrivial, "usage: #{command.usage}"
end
# Get list of plugins (before and after)
plugins_before = PLUGIN_CLASSES.keys.each_with_object({}) { |c, acc| acc[c] = c.all }
- site.code_snippets if site
+ site&.code_snippets
plugins_after = PLUGIN_CLASSES.keys.each_with_object({}) { |c, acc| acc[c] = c.all }
# Divide list of plugins into builtin and custom
plugins_builtin = plugins_before
plugins_custom = plugins_after.each_with_object({}) do |(superclass, klasses), acc|