* Start the Inquiry session * @param {Function} cb Callback when prompt is done * @return {this}
(cb)
| 105809 | */ |
| 105810 | |
| 105811 | _run(cb) { |
| 105812 | this.done = cb; |
| 105813 | |
| 105814 | // Once user confirm (enter key) |
| 105815 | var events = observe(this.rl); |
| 105816 | var submit = events.line.pipe(map(this.getCurrentValue.bind(this))); |
| 105817 | |
| 105818 | var validation = this.handleSubmitEvents(submit); |
| 105819 | validation.success.forEach(this.onEnd.bind(this)); |
| 105820 | validation.error.forEach(this.onError.bind(this)); |
| 105821 | |
| 105822 | events.keypress |
| 105823 | .pipe(takeUntil(validation.success)) |
| 105824 | .forEach(this.onKeypress.bind(this)); |
| 105825 | |
| 105826 | // Init the prompt |
| 105827 | this.render(); |
| 105828 | |
| 105829 | return this; |
| 105830 | } |
| 105831 | |
| 105832 | /** |
| 105833 | * Render the prompt to screen |
nothing calls this directly
no test coverage detected