# -*- encoding: utf-8 -*- require 'webgen/cli/utils' module Webgen module CLI # The CLI command for showing extension bundles. class ShowBundlesCommand < CmdParse::Command def initialize # :nodoc: super('bundles', takes_commands: false) short_desc('Show extension bundles') long_desc(< :installable, :gem => name_tuple.name} end end end bundles.sort do |a, b| if a.last[:state] == b.last[:state] a.first <=> b.first elsif a.last[:state] == :loaded -1 elsif b.last[:state] == :loaded 1 elsif a.last[:state] == :available -1 else 1 end end.each do |name, data| format_bundle_info(name, data) end end def format_bundle_info(name, data) puts(Utils.light(Utils.blue(name))) puts(" State: #{data[:state]}") puts(" Rubygem: #{data[:gem]}") if data[:gem] if command_parser.verbose && data['author'] puts(" Author: #{data['author']}") print(" Summary: ") puts(Utils.format(data['summary'], 78, 12, false)) puts(" Version: #{data['version']}") if data['version'] end puts end private :format_bundle_info end end end