Created
January 6, 2011 23:20
-
-
Save datapimp/768828 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# assignment is pretty | |
# you never have to worry about typing 'var' | |
# and no need to wrap args in () | |
fs = require "fs" | |
sys = require "sys" | |
global.client = require "./client" | |
args = process.argv.slice 2 | |
# i like that in coffeescript | |
# you automatically return the last statement | |
# like in ruby | |
# | |
# also, like in ruby, loops can return an array | |
# of all of the values return from the iterator function | |
commands = for fileName in fs.readdirSync("./commands") | |
do (fileName) -> | |
fileName.replace /\.\w+$/, '' | |
command = args.shift() | |
processor = require("./commands/" + command ) | |
processor.run(args) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment