Skip to content
Myr

Use readline for prompt in express(1)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Douglas Christopher Wilson · committed by Douglas Christopher Wilson · parent 3a1d9b8 · Browse files · 2 files+19 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+19 added−1 removed

  • other:+19 added−1 removed

2 files+19 added−1 removed

modified:bin/express+18 added-1 removed
5 unmodified lines
67var program = require('commander')8 , mkdirp = require('mkdirp')9 , pkg = require('../package.json')10 , readline = require('readline')11 , version = pkg.version12 , os = require('os')13 , fs = require('fs');14
234 unmodified lines
249 emptyDirectory(path, function(empty){250 if (empty || program.force) {251 createApplicationAt(path);252 } else {252 program.confirm('destination is not empty, continue? ', function(ok){253 confirm('destination is not empty, continue? [y/N] ', function (ok) {254 if (ok) {255 process.stdin.destroy();256 createApplicationAt(path);257 } else {
4 unmodified lines
262 });263})(path);264265/**266 * Prompt for confirmation on STDOUT/STDIN267 */268269function confirm(msg, callback) {270 var rl = readline.createInterface({271 input: process.stdin,272 output: process.stdout273 });274275 rl.question(msg, function (input) {276 rl.close();277 callback(/^y|yes|ok|true$/i.test(input));278 });279}280281/**282 * Create application at the given directory `path`.283 *284 * @param {String} path285 */
155 unmodified lines
modified:History.md+1 added
13.x2===34 * Use `readline` for prompt in `express(1)`5 * deps: connect@2.28.16 - deps: body-parser@~1.10.17 - deps: compression@~1.3.08 - deps: connect-timeout@~1.5.0
1930 unmodified lines