commandsHaveLeadingDot = repl.commands['.help']?
if commandsHaveLeadingDot then ".#{commandName}" else commandName
module.exports =
start: (opts = {}) ->
[major, minor, build] = process.versions.node.split('.').map (n) -> parseInt(n)
if major is 0 and minor < 8
console.warn "Node 0.8.0+ required for CoffeeScript REPL"
process.exit 1
CoffeeScript.register()
process.argv = ['coffee'].concat process.argv[2..]
opts = merge replDefaults, opts
repl = nodeREPL.start opts
runInContext opts.prelude, repl.context, 'prelude' if opts.prelude
repl.on 'exit', -> repl.outputStream.write '\n' if not repl.rli.closed
addMultilineHandler repl
addHistory repl, opts.historyFile, opts.historyMaxInputSize if opts.historyFile