Class: ExtJS::XTheme::Command::Help
- Inherits:
-
Base
- Object
- Base
- ExtJS::XTheme::Command::Help
show all
- Defined in:
- lib/extjs-xtheme/commands/help.rb
Defined Under Namespace
Classes: HelpGroup
Instance Attribute Summary
Attributes inherited from Base
#args, #config
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#ask, #display, #error, #escape, #extract_app, #extract_app_in_dir, #extract_option, #heroku, #initialize, #shell
Class Method Details
.create_default_groups! ⇒ Object
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/extjs-xtheme/commands/help.rb', line 31
def self.create_default_groups!
group('General Commands') do
command 'help', 'show this usage'
space
command 'create [<name>]', 'create a new theme'
space
end
group('Effects') do
command 'effects:modulate [<theme> <hue> <saturation> <lightness>]', 'Apply hue, saturation, lightness to a themes\'s images. Specify as Floats, where 1.0 means 100%'
space
end
end
|
.group(title, &block) ⇒ Object
23
24
25
26
27
28
29
|
# File 'lib/extjs-xtheme/commands/help.rb', line 23
def self.group(title, &block)
groups << begin
group = HelpGroup.new(title)
group.instance_eval(&block)
group
end
end
|
.groups ⇒ Object
19
20
21
|
# File 'lib/extjs-xtheme/commands/help.rb', line 19
def self.groups
@groups ||= []
end
|
Instance Method Details
#index ⇒ Object
51
52
53
|
# File 'lib/extjs-xtheme/commands/help.rb', line 51
def index
display usage
end
|
#usage ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/extjs-xtheme/commands/help.rb', line 59
def usage
longest_command_length = self.class.groups.map do |group|
group.map { |g| g.first.length }
end.flatten.max
self.class.groups.inject(StringIO.new) do |output, group|
output.puts "=== %s" % group.title
output.puts
group.each do |command, description|
if command.empty?
output.puts
else
output.puts "%-*s # %s" % [longest_command_length, command, description]
end
end
output.puts
output
end.string
end
|
#version ⇒ Object
55
56
57
|
# File 'lib/extjs-xtheme/commands/help.rb', line 55
def version
end
|