small change README.md
This commit is contained in:
parent
34c192b0bc
commit
06254667d6
1 changed files with 6 additions and 5 deletions
11
README.md
11
README.md
|
@ -59,22 +59,23 @@ If `{noEchoBack: true}` is specified to `options`, echo back is avoided. It is u
|
||||||
currentValue = readlineSync.setEncoding([encoding])
|
currentValue = readlineSync.setEncoding([encoding])
|
||||||
```
|
```
|
||||||
|
|
||||||
Set the encoding method of input (user's response) and output (`prompt`). Defaults to 'utf8'.
|
Set the encoding method of input (user's response) and output (`prompt` and `question`). Defaults to 'utf8'.
|
||||||
|
|
||||||
### setPrint
|
### setPrint
|
||||||
|
|
||||||
```js
|
```js
|
||||||
readlineSync.setPrint(funcPrint)
|
readlineSync.setPrint([funcPrint])
|
||||||
```
|
```
|
||||||
|
|
||||||
The specified Function is called when any texts are outputed (`prompt` and `question`). Two arguments the text which is outputed and `encoding` are passed. Defaults to `undefined`.
|
The specified Function is called when any output (`prompt` and `question`). Defaults to `undefined`.
|
||||||
|
The Function is given two arguments the output text and `encoding`.
|
||||||
|
|
||||||
![sample](cl_01.png)
|
![sample](cl_01.png)
|
||||||
|
|
||||||
For example, this is used to pass plain texts to Logger, when prompt texts are colored.
|
For example, this is used to pass plain texts to Logger, when texts are colored.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
var readlineSync = require('readline-sync');
|
var readlineSync = require('readline-sync'),
|
||||||
user, pw, cmd;
|
user, pw, cmd;
|
||||||
require('colors');
|
require('colors');
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue