Rename read.cs.js -> read-s.cs.js

This commit is contained in:
anseki 2015-03-12 11:03:04 +09:00
parent a225c27e6a
commit cf29238c9a
5 changed files with 25 additions and 25 deletions

View file

@ -34,7 +34,7 @@ answer = readlineSync.question([query[, options]])
``` ```
Display the `query` to the user, and then return the user's response after it has been typed and Enter key was pressed. Display the `query` to the user, and then return the user's response after it has been typed and Enter key was pressed.
You can specify `options` (see [Options](#options)). **You should consider `noEchoBack` option, if the user inputs the secret text (e.g. password).** You can specify `options` (see [Options](#options)). **If the user inputs the secret text (e.g. password), you should consider `noEchoBack` option.**
The `query` may be string, or may not be (e.g. number, Date, Object, etc.). This is converted to string (i.e. `toString` method is called) before it is displayed. The `query` may be string, or may not be (e.g. number, Date, Object, etc.). This is converted to string (i.e. `toString` method is called) before it is displayed.
@ -45,7 +45,7 @@ input = readlineSync.prompt([options])
``` ```
Display the current prompt (See `setPrompt` method) to the user, and then return the user's response after it has been typed and Enter key was pressed. Display the current prompt (See `setPrompt` method) to the user, and then return the user's response after it has been typed and Enter key was pressed.
You can specify `options` (see [Options](#options)). **You should consider `noEchoBack` option, if the user inputs the secret text (e.g. password).** You can specify `options` (see [Options](#options)). **If the user inputs the secret text (e.g. password), you should consider `noEchoBack` option.**
### setPrompt ### setPrompt

View file

@ -1,20 +1,20 @@
/* global WScript:false */ /*jshint wsh:true */
var oExec; var oExec;
// exit-code is not returned even if an error is thrown. // exit-code is not returned even if an error is thrown.
try { try {
WScript.StdOut.Write(WScript.CreateObject('ScriptPW.Password').GetPassword() WScript.StdOut.Write(WScript.CreateObject('ScriptPW.Password').GetPassword()
// Bug? Illegal data may be returned when user types before initializing. // Bug? Illegal data may be returned when user types before initializing.
.replace(/[\u4000-\u40FF]/g, function(chr) { .replace(/[\u4000-\u40FF]/g, function(chr) {
var charCode = chr.charCodeAt(0); var charCode = chr.charCodeAt(0);
return charCode >= 0x4020 && charCode <= 0x407F ? return charCode >= 0x4020 && charCode <= 0x407F ?
String.fromCharCode(charCode - 0x4000) : ''; String.fromCharCode(charCode - 0x4000) : '';
})); }));
} catch (e) { } catch (e) {
WScript.StdErr.Write(e.description); WScript.StdErr.Write(e.description);
WScript.Quit(1); WScript.Quit(1);
} }
oExec = WScript.CreateObject('WScript.Shell').Exec('cmd /c echo; >CON'); oExec = WScript.CreateObject('WScript.Shell').Exec('cmd /c echo; >CON');
while (oExec.Status === 0) { WScript.Sleep(100); } while (oExec.Status === 0) { WScript.Sleep(100); }

View file

@ -47,7 +47,7 @@ powershell /? >NUL 2>&1
:: Win XP and Server2003 have `ScriptPW` (`scriptpw.dll`). :: Win XP and Server2003 have `ScriptPW` (`scriptpw.dll`).
:: In the systems that don't have both, an error is thrown. :: In the systems that don't have both, an error is thrown.
if ERRORLEVEL 1 ( if ERRORLEVEL 1 (
set "exec_line=cscript //nologo "%~dp0read.cs.js"" set "exec_line=cscript //nologo "%~dp0read-s.cs.js""
) else ( ) else (
set "exec_line=powershell -Command "$text = read-host -AsSecureString; ^ set "exec_line=powershell -Command "$text = read-host -AsSecureString; ^
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR^($text^); ^ $BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR^($text^); ^

View file

@ -1,4 +1,4 @@
# Silent Read # Silent Read : emulate `read -s` of bash/zsh
read_s() { read_s() {
stty --file=/dev/tty -echo echonl 2>/dev/null || \ stty --file=/dev/tty -echo echonl 2>/dev/null || \
stty -F /dev/tty -echo echonl 2>/dev/null || \ stty -F /dev/tty -echo echonl 2>/dev/null || \

View file

@ -2,7 +2,7 @@
"name": "readline-sync", "name": "readline-sync",
"version": "0.7.6", "version": "0.7.6",
"title": "readlineSync", "title": "readlineSync",
"description": "Synchronous Readline", "description": "Synchronous Readline for interactively running to have a conversation with the user via a console(TTY).",
"keywords": [ "keywords": [
"readline", "readline",
"synchronous", "synchronous",