Created
May 12, 2011 11:04
-
-
Save twilson63/968325 to your computer and use it in GitHub Desktop.
Ask Method for your Cakefile
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@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