Class: Rouge::CLI::List
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Rouge::CLI
class_from_arg, error!, #error!, #initialize
Constructor Details
This class inherits a constructor from Rouge::CLI
Class Method Details
.desc ⇒ Object
316
317
318
|
# File 'lib/rouge/cli.rb', line 316
def self.desc
"list available lexers"
end
|
.doc {|%|usage: rouge list|| ... } ⇒ Object
320
321
322
323
324
325
326
|
# File 'lib/rouge/cli.rb', line 320
def self.doc
return enum_for(:doc) unless block_given?
yield %|usage: rouge list|
yield %||
yield %|print a list of all available lexers with their descriptions.|
end
|
.parse(argv) ⇒ Object
328
329
330
|
# File 'lib/rouge/cli.rb', line 328
def self.parse(argv)
new
end
|
Instance Method Details
#run ⇒ Object
332
333
334
335
336
337
338
339
340
341
342
343
|
# File 'lib/rouge/cli.rb', line 332
def run
puts "== Available Lexers =="
Lexer.all.sort_by(&:tag).each do |lexer|
desc = "#{lexer.desc}"
if lexer.aliases.any?
desc << " [aliases: #{lexer.aliases.join(',')}]"
end
puts "%s: %s" % [lexer.tag, desc]
puts
end
end
|