UNPKG

pabala-biu

Version:

Changelogs

34 lines (25 loc) 656 B
import inquirer from 'inquirer'; const questions:Array<any> = [ { type: 'input', name: 'project_name', message: '输入项目名称', validate: function (value:string) { return true } } ]; function hanleFunc (answers:any) { } export default function interactive() { return inquirer .prompt(questions) .then(answers => hanleFunc(answers)) .catch(error => { if (error.isTtyError) { // Prompt couldn't be rendered in the current environment } else { // Something else when wrong } }); }