Skip to content

Instantly share code, notes, and snippets.

@craigw
Created July 20, 2009 19:37
Show Gist options
  • Select an option

  • Save craigw/150812 to your computer and use it in GitHub Desktop.

Select an option

Save craigw/150812 to your computer and use it in GitHub Desktop.
#! /usr/bin/env ruby
COMMANDS = File.expand_path(File.dirname(__FILE__))
name, channel, username, command, arguments = *ARGV[0].split(/ /, 5)
command_script = File.join(COMMANDS, File.basename(command))
if File.exists?(command_script) && !%W(run router).include?(command)
load command_script
puts Command.execute(name, channel, username, arguments).strip
else
desired_command = "#{command} #{arguments}".strip
puts "Sorry #{name}, I don't understand `#{desired_command}`."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment