Skip to content

Instantly share code, notes, and snippets.

@stagas
Created August 7, 2011 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stagas/1130184 to your computer and use it in GitHub Desktop.
Save stagas/1130184 to your computer and use it in GitHub Desktop.
prompt
var readline = require('readline')
, rl = readline.createInterface(process.stdin, process.stdout)
function prompt (str, cb) {
rl.setPrompt(str)
rl.prompt()
rl.once('line', cb)
}
prompt('> ', function (str) {
console.log(str)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment