Class Webgen::CliUtils
In: lib/webgen/cli.rb
Parent: Object
RuntimeError PluginParamNotFound PluginNotFound ConfigurationFileInvalid CmdParse::CommandParser CommandParser DirectoryInfo GalleryStyle WebSiteStyle WebSiteTemplate SipttraStyle Test::Unit::TestCase TestCase PluginTestCase TagTestCase CmdParse::Command ShowCommand CheckCommand UseCommand CreateCommand TSort DependencyHash Hash Comparable Language DEFAULT_WRAPPER_MODULE WebSite ::Logger Logger Logger Qt::MainWindow MainWindow Qt::Dialog NewWebsiteDialog Qt::TextEdit LogWidget ::Rake::TaskLib WebgenTask ConfigurationFile Website PluginManager PluginLoader PluginParamValueNotFound Dummy Color CliUtils PluginDefs lib/webgen/languages.rb lib/webgen/website.rb lib/webgen/gui/common.rb lib/webgen/plugin.rb lib/webgen/test.rb lib/webgen/cli.rb ClassMethods PluginDefs LanguageManager lib/webgen/gui/new_website_dlg.rb lib/webgen/gui/main.rb GUI lib/webgen/rake/webgentask.rb Rake Webgen dot/m_60_0.png

Methods

Public Class methods

[Source]

    # File lib/webgen/cli.rb, line 75
75:     def self.dirinfo_output( opts, name, dirinfo )
76:       ljust = 15 + opts.summary_indent.length
77:       opts.separator CliUtils.section( 'Name', ljust, opts.summary_indent.length + 2 ) + "#{Color.lred( name )}"
78: 
79:       dirinfo.infos.sort.each do |name, value|
80:         desc = CliUtils.format( value, ljust )
81:         opts.separator CliUtils.section( name.capitalize, ljust, opts.summary_indent.length + 2 ) + desc.shift
82:         desc.each {|line| opts.separator line}
83:       end
84:       opts.separator ''
85:     end

[Source]

    # File lib/webgen/cli.rb, line 54
54:     def self.format( content, indent = 0, width = 100 )
55:       content ||= ''
56:       return [content] if content.length + indent <= width
57:       lines = []
58:       while content.length + indent > width
59:         index = content[0..(width-indent-1)].rindex(' ')
60:         lines << (lines.empty? ? '' : ' '*indent) + content[0..index]
61:         content = content[index+1..-1]
62:       end
63:       lines << ' '*indent + content unless content.strip.empty?
64:       lines
65:     end

[Source]

    # File lib/webgen/cli.rb, line 67
67:     def self.headline( text, indent = 2 )
68:       ' '*indent + "#{Color.bold( text )}"
69:     end

[Source]

    # File lib/webgen/cli.rb, line 71
71:     def self.section( text, ljustlength = 0, indent = 4, color = :green )
72:       ' '*indent + "#{Color.send( color, text )}".ljust( ljustlength - indent + Color.send( color ).length + Color.reset.length )
73:     end

[Validate]