-
Notifications
You must be signed in to change notification settings - Fork 328
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move prompt output to stderr. Closes #5489
- Loading branch information
1 parent
6fa2bd1
commit 5b7be83
Showing
5 changed files
with
59 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { Cli } from '../cli/Cli.js'; | ||
import { settingsNames } from '../settingsNames.js'; | ||
|
||
let inquirer: typeof import('inquirer') | undefined; | ||
|
||
export const prompt = { | ||
/* c8 ignore next 10 */ | ||
async forInput<T>(config: any, answers?: any): Promise<T> { | ||
if (!inquirer) { | ||
inquirer = await import('inquirer'); | ||
} | ||
|
||
const cli = Cli.getInstance(); | ||
const errorOutput: string = cli.getSettingWithDefaultValue(settingsNames.errorOutput, 'stderr'); | ||
const prompt = inquirer.createPromptModule({ output: errorOutput === 'stderr' ? process.stderr : process.stdout }); | ||
|
||
return await prompt(config, answers) as any; | ||
} | ||
}; |