Class: Rouge::CLI::Help
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Rouge::CLI
class_from_arg, error!, #error!
Constructor Details
#initialize(opts = {}) ⇒ Help
Returns a new instance of Help.
158
159
160
|
# File 'lib/rouge/cli.rb', line 158
def initialize(opts={})
@mode = opts[:mode]
end
|
Class Method Details
.desc ⇒ Object
133
134
135
|
# File 'lib/rouge/cli.rb', line 133
def self.desc
"print help info"
end
|
.doc {|%|usage: rougify help <command>|| ... } ⇒ Object
137
138
139
140
141
142
143
|
# File 'lib/rouge/cli.rb', line 137
def self.doc
return enum_for(:doc) unless block_given?
yield %|usage: rougify help <command>|
yield %||
yield %|print help info for <command>.|
end
|
.parse(argv) ⇒ Object
145
146
147
148
149
150
151
152
153
154
155
156
|
# File 'lib/rouge/cli.rb', line 145
def self.parse(argv)
opts = { :mode => CLI }
until argv.empty?
arg = argv.shift
klass = class_from_arg(arg)
if klass
opts[:mode] = klass
next
end
end
new(opts)
end
|
Instance Method Details
#run ⇒ Object
162
163
164
|
# File 'lib/rouge/cli.rb', line 162
def run
@mode.doc.each(&method(:puts))
end
|