class ArgManager
woodstove argmanager - a simple argument manager for woodstove Copyright © 2016 the furry entertainment project Licensed under the MIT license.
Public Class Methods
new()
click to toggle source
# File lib/woodstove/argmanager.rb, line 5 def initialize @commands = {} end
Public Instance Methods
commands()
click to toggle source
# File lib/woodstove/argmanager.rb, line 23 def commands @commands end
register(key, command)
click to toggle source
# File lib/woodstove/argmanager.rb, line 20 def register key, command @commands[key] = command end
run()
click to toggle source
# File lib/woodstove/argmanager.rb, line 8 def run @commands.each do |command| if ARGV[0] == command[1].long || ARGV[0] == command[1].short command[1].run ARGV[1..-1] return end end if @commands[:help] @commands[:help].incorrect_usage exit 1 end end