class Punt

Constants

CMDS

Public Class Methods

cmd(argv) click to toggle source
# File lib/punt.rb, line 25
def self.cmd(argv)
    first = argv.shift
    matching_cmd = find_cmd(first)

    usage and return unless matching_cmd

    matching_cmd.run(argv)
end

Private Class Methods

find_cmd(arg) click to toggle source
# File lib/punt.rb, line 35
def self.find_cmd(arg)
    return CMDS.reject {|cmd| cmd.name != arg }.first
end
usage() click to toggle source
# File lib/punt.rb, line 39
def self.usage()
    puts "Usage: punt [cmd] [cmd-arguments]"
    puts ""
    puts "punt recognizes the following commands:"
    puts ""
    CMDS.each do |cmdClazz|
        puts "\t#{cmdClazz.name} - #{cmdClazz.summary}"
    end
end