Skip to content

Instantly share code, notes, and snippets.

@datapimp
Created January 6, 2011 23:20
Show Gist options
  • Save datapimp/768828 to your computer and use it in GitHub Desktop.
Save datapimp/768828 to your computer and use it in GitHub Desktop.
# 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