Class: Rouge::CLI::List

Inherits:
Rouge::CLI show all
Defined in:
lib/rouge/cli.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Rouge::CLI

class_from_arg, #error!, #initialize

Constructor Details

This class inherits a constructor from Rouge::CLI

Class Method Details

.descObject


289
290
291
# File 'lib/rouge/cli.rb', line 289

def self.desc
  "list available lexers"
end

.doc {|%|usage: rouge list|| ... } ⇒ Object

Yields:

  • (%|usage: rouge list|)

293
294
295
296
297
298
299
# File 'lib/rouge/cli.rb', line 293

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


301
302
303
# File 'lib/rouge/cli.rb', line 301

def self.parse(argv)
  new
end

Instance Method Details

#runObject


305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/rouge/cli.rb', line 305

def run
  puts "== Available Lexers =="

  Lexer.all.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