Class: Webgen::CLI::ShowExtensionsCommand
- Inherits:
-
CmdParse::Command
- Object
- CmdParse::Command
- Webgen::CLI::ShowExtensionsCommand
- Defined in:
- lib/webgen/cli/commands/show_extensions.rb
Overview
The CLI command for showing available extension.
Instance Method Summary collapse
-
#execute(selector = '') ⇒ Object
:nodoc:.
-
#initialize ⇒ ShowExtensionsCommand
constructor
:nodoc:.
Constructor Details
#initialize ⇒ ShowExtensionsCommand
:nodoc:
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/webgen/cli/commands/show_extensions.rb', line 11 def initialize # :nodoc: super('extensions', takes_commands: false) short_desc('Show available extensions') long_desc("Shows all available extensions and additional information about them, e.g. a\nshort summary of the functionality or the extension bundle it is defined in.\n\nIf an argument is given, only those extensions that have the argument in their\nname are displayed.\n\nHint: The global verbosity option enables additional output.\n") .on("-b NAME", "--bundle NAME", String, "Only show extensions of this bundle") do |bundle| @bundle = bundle end @bundle = nil end |
Instance Method Details
#execute(selector = '') ⇒ Object
:nodoc:
29 30 31 32 33 34 35 |
# File 'lib/webgen/cli/commands/show_extensions.rb', line 29 def execute(selector = '') # :nodoc: command_parser.website.ext.bundle_infos.extensions.select do |n, d| n.include?(selector) && (@bundle.nil? || d['bundle'] == @bundle) end.sort.each do |name, data| format_extension_info(name, data, !selector.empty?) end end |