diff options
author | isaacs <i@izs.me> | 2012-07-24 12:21:37 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2012-07-24 12:21:37 +0400 |
commit | afd2514dcf86c83422f6b46bc050bda248ea2b61 (patch) | |
tree | 4dbaa056b87e92e1d39d6775f6fe7a93bd8d5806 /node_modules/read/README.md | |
parent | 45dd5182fd1607981bad69c7e9f8e3331e68ef73 (diff) |
Upgrade read to 1.0
Diffstat (limited to 'node_modules/read/README.md')
-rw-r--r-- | node_modules/read/README.md | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/node_modules/read/README.md b/node_modules/read/README.md index 2c19d1401..917e703fc 100644 --- a/node_modules/read/README.md +++ b/node_modules/read/README.md @@ -1,5 +1,10 @@ +## read + For reading user input from stdin. +Similar to the `readline` builtin's `question()` method, but with a +few more features. + ## USAGE ```javascript @@ -8,7 +13,7 @@ read(options, callback) ``` The callback gets called with either the user input, or the default -specified, or an error, in the traditional `callback(error, result)` +specified, or an error, as `callback(error, result, isDefault)` node style. ## OPTIONS @@ -17,28 +22,16 @@ Every option is optional. * `prompt` What to write to stdout before reading input. * `silent` Don't echo the output as the user types it. -* `num` Max number of chars to read from terminal. * `timeout` Number of ms to wait for user input before giving up. * `default` The default value if the user enters nothing. +* `edit` Allow the user to edit the default value. +* `terminal` Treat the output as a TTY, whether it is or not. * `stdin` Readable stream to get input data from. (default `process.stdin`) * `stdout` Writeable stream to write prompts to. (default: `process.stdout`) -If silent is true, or num is set, and the input is a TTY, -then read will set raw mode, and read character by character. - -At this time, backspace and arrow keys are not supported very well. -It's probably not too hard to add support for this, perhaps using node's -built-in readline module. +If silent is true, and the input is a TTY, then read will set raw +mode, and read character by character. ## CONTRIBUTING Patches welcome. - -## BUGS - -In node 0.6.0 through 0.6.5, you must explicitly call -`process.stdin.destroy()` or `process.exit()` when you know that your -program is done reading, or else it will keep the event loop running -forever. - -See: <https://github.com/joyent/node/issues/2257> |