* Render the prompt to screen * @return {PasswordPrompt} self
(error)
| 105694 | */ |
| 105695 | |
| 105696 | render(error) { |
| 105697 | var message = this.getQuestion(); |
| 105698 | var bottomContent = ''; |
| 105699 | |
| 105700 | if (this.status === 'answered') { |
| 105701 | message += this.opt.mask |
| 105702 | ? chalk.cyan(mask(this.answer, this.opt.mask)) |
| 105703 | : chalk.italic.dim('[hidden]'); |
| 105704 | } else if (this.opt.mask) { |
| 105705 | message += mask(this.rl.line || '', this.opt.mask); |
| 105706 | } else { |
| 105707 | message += chalk.italic.dim('[input is hidden] '); |
| 105708 | } |
| 105709 | |
| 105710 | if (error) { |
| 105711 | bottomContent = '\n' + chalk.red('>> ') + error; |
| 105712 | } |
| 105713 | |
| 105714 | this.screen.render(message, bottomContent); |
| 105715 | } |
| 105716 | |
| 105717 | /** |
| 105718 | * When user press `enter` key |
no test coverage detected