Class: Rouge::CLI::List
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Rouge::CLI
class_from_arg, error!, #error!, #initialize, normalize_syntax
Constructor Details
This class inherits a constructor from Rouge::CLI
Class Method Details
.desc ⇒ Object
348
349
350
|
# File 'lib/rouge/cli.rb', line 348
def self.desc
"list available lexers"
end
|
.doc {|%|usage: rouge list|| ... } ⇒ Object
352
353
354
355
356
357
358
|
# File 'lib/rouge/cli.rb', line 352
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
360
361
362
|
# File 'lib/rouge/cli.rb', line 360
def self.parse(argv)
new
end
|
Instance Method Details
#run ⇒ Object
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
|
# File 'lib/rouge/cli.rb', line 364
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]
lexer.option_docs.keys.sort.each do |option|
puts " ?#{option}= #{lexer.option_docs[option]}"
end
puts
end
end
|