Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

50 lines (38 sloc) 1.223 kb
io = require ""
program = require "commander"
# Setup event notifications to deal with asynchronous
# tasks in the program.
{EventEmitter} = require "events" = events = new EventEmitter()
.option("-u, --user [user]", "Specify user")
.option("-U, --url [url]", "Specify url, defaults to", "")
.parse process.argv
program.commands = {}
events.on "user", ->
program.password "Password: ", "*", (password) ->
program.password = password
events.emit "password"
events.on "password", ->
program.socket = socket = io.connect program.url
socket.emit "sign-in",
user : program.user
password : program.password
onError = (err) ->
console.error "Error while signing in!"
console.dir err if err?
process.exit 1
socket.on "error", onError
socket.on "signed-in", (user) ->
program.user = user
socket.removeListener "error", onError
console.log "Signed in!"
events.emit "ready"
if program.user?
events.emit "user"
program.prompt "User: ", (user) ->
program.user = user
events.emit "user"
module.exports = program
Jump to Line
Something went wrong with that request. Please try again.