Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

deprecation warning added to README

  • Loading branch information...
commit 456f5e6631c93ea2f030723ff6decb18afda5288 1 parent 8cdf50f
@jfhbrook authored
Showing with 50 additions and 83 deletions.
  1. +50 −83 README.md
View
133 README.md
@@ -1,8 +1,31 @@
-# PROMPT
+# PROMPT [DEPRECATED]
-## What:
+## Deprecated, you say?
-A way to request information from the user while a node.js script is running,
+That's right! For your prompting needs, check out
+<https://github.com/nodejitsu/node-prompt/> instead! If you use npm, I gave the
+"prompt" name to them, so `npm install prompt` should do you! If you really
+need this version, you'll have to do things the "hard" way: Copy prompt.js into
+your project.
+
+### Wait, why?
+
+When I originally wrote `prompt` I needed something like it for my
+[brainfuck interpreter](https://github.com/jesusabdullah/bf.js/) so the very
+clever [pkrumins](http://catonmat.net) helped me hack a prompting library
+together via a gist. After that I didn't have much of a use for prompting so I
+let the project languish. I did get some help from
+[eldios](https://github.com/eldios), whose efforts I appreciate greatly.
+
+Meanwhile, however, the [hackers](https://github.com/nodejitsu) at
+[Nodejitsu](http://nodejitsu.com) built their library for a core piece of their
+platform, [jitsu](https://github.com/nodejitsu/jitsu/). So, not only are these
+guys good at what they do, but the library is also battle-tested and expected to
+appreciate steady development over the long-term. Plus, it has a nice API.
+
+## So What's *This* Prompt?:
+
+"Prompt," in this incarnation, was 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:
@@ -14,25 +37,14 @@ 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
-
-To those of you that don't, this module is simple enough that hopefully the
-process is pretty clear.
+## A Quick Migration Guide:
-## Usage & Examples:
+As it turns out, Nodejitsu's prompt is already much more powerful than this
+incarnation. While the API is different, conversion should be relatively
+painless.
-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.
+For example, here's an example I wrote using this version of node-prompt:
-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:
var Prompt = require('./prompt');
@@ -52,67 +64,22 @@ It's probably easiest to follow from example:
})
.end();
-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:
-
- var Prompt = require('prompt');
-
- Prompt()
- .ask('Username: ', 'user')
- .discreet('Password: ', 'pass')
- .tap(function (vars) {
- spawn('mutt', ['-s', 'Some pwned guy: '+vars.user+':'+vars.pass, 'josh.holbrook@gmail.com']);
- }).end();
-
-But would I actually do that to you? No. ;)
-
-## Bone-Picking:
-
-Make a github issue and/or pull, write something (even a test that breaks
-Prompt) and request that I pull.
-
-## 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:
-
-The MIT License
-
-Copyright (c) 2011 Joshua Holbrook
-
-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:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-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.
+Here's a basic rewrite using the new Prompt that (basically) does the same
+thing:
+
+ var prompt = require('prompt').start();
+
+ prompt.get({ message: "What is your name?",
+ name: 'name' },
+ { message: "What is your quest?",
+ name: 'quest' },
+ { message: "What is your favorite color?",
+ name: 'color' }, function(err, res) {
+ console.log('So you\'re '+res.name+' and your quest is '+res.quest+' and your favorite color is '+res.color+'?');
+ console.log('Okay, off you go!');
+ });
+
+You may have noticed that instead of intercepting values each time, I just
+collected all of them at once. If this is a sticking point for you, a strict
+port is also easy, as you can always `.get` each variable separately. Oh, and
+the new prompt is chainable too. Pretty awesome!
Please sign in to comment.
Something went wrong with that request. Please try again.