Inquirer.js icon indicating copy to clipboard operation
Inquirer.js copied to clipboard

Clear the questionnaire ?

Open udithv opened this issue 6 years ago • 4 comments

how do I clear the entire questionnaire after all of it is asked.

udithv avatar Nov 11 '18 05:11 udithv

Do you mean to clean the terminal?

SBoudrias avatar Nov 12 '18 04:11 SBoudrias

@SBoudrias yes but not the whole console. just the output. Something like logUpdate module where the output is replaced with another... only in my case it has to be replaced with nothing.

udithv avatar Nov 12 '18 04:11 udithv

Any update?

bczak avatar Jan 14 '21 19:01 bczak

Jump out of your question, I think Ink is a better tool to implement your idea.

LitoMore avatar Apr 24 '21 03:04 LitoMore

I've just implemented that by using console.clear:

2022-08-30 at 16 23 17 - Blue Owl

In my case, I have multiple prompts, and before jumping from one to another, I run a console.clear and then show my CLI title again.

raulfdm avatar Aug 30 '22 14:08 raulfdm

Hello, I've added this feature in our new prompts (the @inquirer/* modules.)

SBoudrias avatar Aug 31 '22 02:08 SBoudrias

@SBoudrias, what do you mean exactly?

Is there documentation about this somewhere?

raulfdm avatar Aug 31 '22 19:08 raulfdm

There's types and documentation per prompts; but not a great consolidated doc yet. Here's an example code:

import confirm from '@inquirer/confirm';

const answer = await confirm(
  { message: 'Confirm action?' },
  { clearPromptOnDone: true }
);

SBoudrias avatar Aug 31 '22 20:08 SBoudrias