mirror of
https://github.com/zhigang1992/now-deployment.git
synced 2026-06-16 11:49:51 +08:00
22 lines
488 B
TypeScript
22 lines
488 B
TypeScript
import chalk from 'chalk';
|
|
import { Output } from './output';
|
|
|
|
async function promptBool(output: Output, message: string) {
|
|
return new Promise(resolve => {
|
|
output.print(`${chalk.gray('>')} ${message} ${chalk.gray('[y/N] ')}`);
|
|
process.stdin
|
|
.on('data', d => {
|
|
process.stdin.pause();
|
|
resolve(
|
|
d
|
|
.toString()
|
|
.trim()
|
|
.toLowerCase() === 'y'
|
|
);
|
|
})
|
|
.resume();
|
|
});
|
|
}
|
|
|
|
export default promptBool;
|