class Pedant::Command
Public Class Methods
all()
click to toggle source
# File lib/pedant/command.rb, line 33 def self.all (@_all ||= []) end
find(cmd)
click to toggle source
# File lib/pedant/command.rb, line 45 def self.find(cmd) all.each do |cls| return cls if cls.binding == cmd end nil end
inherited(cls)
click to toggle source
# File lib/pedant/command.rb, line 37 def self.inherited(cls) all << cls end
initialize!()
click to toggle source
# File lib/pedant/command.rb, line 29 def self.initialize! Dir.glob(Pedant.lib + 'pedant/commands/*.rb').each {|f| load(f)} end
list()
click to toggle source
# File lib/pedant/command.rb, line 41 def self.list all.map{ |cls| cls.binding }.sort end
run(opts, args)
click to toggle source
# File lib/pedant/command.rb, line 68 def self.run(opts, args) # Parse the command's arguments. opts, args = optparse(opts, args) # Run the command. self.run_all(opts, args) end
usage(msg)
click to toggle source
# File lib/pedant/command.rb, line 76 def self.usage(msg) puts Rainbow(msg).color(:red) puts puts help exit 1 end