prompt-sync
Advanced tools
Comparing version 4.1.7 to 4.2.0
13
index.js
@@ -23,2 +23,3 @@ 'use strict' | ||
var sigint = config.sigint; | ||
var eot = config.eot; | ||
var autocomplete = config.autocomplete = | ||
@@ -72,3 +73,3 @@ config.autocomplete || function(){return []}; | ||
var buf = new Buffer(3); | ||
var buf = Buffer.alloc(3); | ||
var str = '', character, read; | ||
@@ -136,3 +137,3 @@ | ||
process.stdout.write('\u001b[' + (insert+ask.length+1) + 'G'); | ||
buf = new Buffer(3); | ||
buf = Buffer.alloc(3); | ||
} | ||
@@ -158,2 +159,10 @@ } | ||
// catch a ^D and exit | ||
if (character == 4) { | ||
if (str.length == 0 && eot) { | ||
process.stdout.write('exit\n'); | ||
process.exit(0); | ||
} | ||
} | ||
// catch the terminating character | ||
@@ -160,0 +169,0 @@ if (character == term) { |
{ | ||
"name": "prompt-sync", | ||
"version": "4.1.7", | ||
"version": "4.2.0", | ||
"description": "a synchronous prompt for node.js", | ||
@@ -11,3 +11,3 @@ "main": "index.js", | ||
"type": "git", | ||
"url": "https://github.com/0x00A/prompt-sync.git" | ||
"url": "https://github.com/heapwolf/prompt-sync.git" | ||
}, | ||
@@ -14,0 +14,0 @@ "keywords": [ |
@@ -44,2 +44,4 @@ # SYNOPSIS | ||
`eot`: Default is `false`. A ^D pressed as the first character of an input line causes prompt-sync to echo `exit` and exit the process with code 0. | ||
`autocomplete`: A completer function that will be called when user enters TAB to allow for autocomplete. It takes a string as an argument an returns an array of strings that are possible matches for completion. An empty array is returned if there are no matches. | ||
@@ -46,0 +48,0 @@ |
14233
5
233
119