7

First of all: I don't mean parsing arguments and options from the process.argv array, but prompting the user and handling input/output. I've looked through the Node.js official module list without finding any sections or subsections that mentions input. In fact a search for 'input' on that page only gets 1 result which has something to do with YAML.

Anyway, I suppose cli input should be asynchronous and I've solved this issue before using stdin.on('data') which was messy to say the least. This seems like a perfect task for a node module which could come with extra goodies such as progress bars, spinners, coloured output, input validation etc.

There probably are some modules out there that does this, but I can't find any of them.

Help!!

(To clarify, the only functionality I require is the simplification of handling user input)

2
  • 1
    I gave this an upvote, favorited it and shared it on both Facebook and Twitter, but now, please, append a "?" at your question! Commented Jan 22, 2012 at 0:49
  • I guess that slipped me by when I refactored the title. It started out as "Getting user input from the command line" :P Commented Jan 22, 2012 at 0:51

1 Answer 1

12

Search for modules here: http://eirikb.github.com/nipster/

Also, if you want to write your own: http://nodejs.org/docs/latest/api/all.html#readline

#node.js IRC welcomes you: http://webchat.freenode.net/?channels=node.js

Sign up to request clarification or add additional context in comments.

1 Comment

Brilliant answer, I wish I could vote it up ten times. Input validation is built in to prompt by the way

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.