Comparing version 0.0.3 to 0.0.4
{ | ||
"name" : "prompt", | ||
"version" : "0.0.3", | ||
"version" : "0.0.4", | ||
"description" : "Prompt the user of command line scripts while running.", | ||
@@ -12,5 +12,6 @@ "main" : "./prompt.js", | ||
"contributors" : [ | ||
"Peteris Krumins (http://catonmat.net)" | ||
"Peteris Krumins (http://catonmat.net)", | ||
"Lele 'El Dios' (http://lele.amicofigo.com/)" | ||
], | ||
"engine" : ["node >=0.1.100"] | ||
} |
@@ -79,2 +79,3 @@ var sys = require('sys'); | ||
} else { | ||
p.setEncoding("utf8") | ||
p.on('data', function(line) { | ||
@@ -81,0 +82,0 @@ p.removeAllListeners('data'); |
@@ -5,3 +5,6 @@ # PROMPT | ||
A way to request information from the user while a node.js script is running, on the command line, without invoking a REPL. Many languages have something very simple for this sort of thing built-in--for instance, you may have something like this in an early BASIC-ish program: | ||
A way to request information from the user while a node.js script is running, | ||
on the command line, without invoking a REPL. Many languages have something very | ||
simple for this sort of thing built-in--for instance, you may have something | ||
like this in an early BASIC-ish program: | ||
@@ -11,14 +14,24 @@ r = input( 'Give me a radius: ' ); | ||
To my surprise, node.js didn't have anything quite like this, though it had the tools (process.openStdin) to make something like it. So, with a lot of help, I did. | ||
To my surprise, node.js didn't have anything quite like this, though it had the | ||
tools (process.openStdin) to make something like it. So, with a lot of help, | ||
I did. | ||
## Install: | ||
The easiest way is to use npm: | ||
npm install prompt | ||
## Usage: | ||
To those of you that don't, this module is simple enough that hopefully the | ||
process is pretty clear. | ||
While this module was originally inspired by BASIC-style prompts, the current api is quite a bit different, but much more useful in an asynchronous context. | ||
## Usage & Examples: | ||
Prompt() is an object with the methods .ask, .tap and .end. Chain these methods together to ask questions and do things to them, then call .end() to cap the chain. | ||
While this module was originally inspired by BASIC-style prompts, the current | ||
api is quite a bit different, but much more useful in an asynchronous context. | ||
Prompt() is an object with the methods .ask, .tap and .end. Chain these methods | ||
together to ask questions and do things to them, then call .end() to cap the | ||
chain. | ||
It's probably easiest to follow from example: | ||
@@ -44,5 +57,10 @@ | ||
Simple examples may be found in the `test/` folder (which are also tests for | ||
node-prompt). More in-depth examples may be found in the `examples/` folder, as | ||
they are written (there's only one right now). | ||
## Asking for passwords and stuff: | ||
Prompt also has a 'discreet' mode, which doesn't show what you type in to the screen: | ||
Prompt also has a 'discreet' mode, which doesn't show what you type in to the | ||
screen: | ||
@@ -62,23 +80,43 @@ var Prompt = require('prompt'); | ||
Make a github issue and/or pull, write something (even a test that breaks Prompt) and request that I pull. | ||
Make a github issue and/or pull, write something (even a test that breaks | ||
Prompt) and request that I pull. | ||
## Authors: | ||
## To-Do: | ||
Prompt could use some TLC: | ||
1. There's no protection (yet) for two instances of Prompt trying to use openStdin | ||
at the same time. Similar problems occur between Prompt and the REPL. | ||
2. I would like to rewrite prompt to use chainsaw, in order to clean up some of | ||
the boilerplate. this might also make deprecating .end() easy. | ||
## Authors and Contributors: | ||
* Joshua Holbrook ( <http://jesusabdullah.github.com/> ) | ||
* Peteris Krumins ( <http://catonmat.net> ) | ||
* Lele "El Dios" ( <http://lele.amicofigo.com/> ) | ||
## Licensing: | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
Version 2, December 2004 | ||
The MIT License | ||
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> | ||
Copyright (c) 2011 Joshua Holbrook | ||
Everyone is permitted to copy and distribute verbatim or modified | ||
copies of this license document, and changing it is allowed as long | ||
as the name is changed. | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE | ||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION | ||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
0. You just DO WHAT THE FUCK YOU WANT TO. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
10480
174
119