Skip to content

Instantly share code, notes, and snippets.

@twilson63
Created May 12, 2011 11:04
Show Gist options
  • Save twilson63/968325 to your computer and use it in GitHub Desktop.
Save twilson63/968325 to your computer and use it in GitHub Desktop.
Ask Method for your Cakefile
ask = (question, format, callback) ->
stdin = process.stdin
stdout = process.stdout
stdin.resume()
stdout.write "#{question}:"
stdin.once 'data', (data) ->
data = data.toString().trim()
if format.test(data)
callback data
else
stdout.write "It should match: #{format}\n"
ask(question, format, callback)
@twilson63
Copy link
Author

@tbeseda

You can also install via npm

npm install ask -g

then use in your cake files

{ ask } = require('ask')

Check out https://github.com/twilson63/ask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment