1.0.1 • Published 3 years ago

star_hezhaodi v1.0.1

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago
#!/usr/bin/env node

const program = require("commander");
const inquirer = require("inquirer");
program.description("星座").version("1.0.0");

const starChoices = [
    {
        type: "list",
        name: 'star',
        message: "请选择你的星座",
        pageSize:6,
        choices: [
            "金牛座",
            "狮子座", 
            "天蝎座", 
            "摩羯座", 
            "双子座", 
            "白羊座", 
            "水瓶座", 
            "巨蟹座", 
            "天秤座", 
            "处女座", 
            "射手座"
        ]
    },
    {
        type:"confirm",
        name:"search",
        message:"查询星座是否正确",
    }
]


program.command("create").action(dir => {
    inquirer.prompt(starChoices).then(res => {
        let {star,search}=res;
        if(search){
            console.log(`你的星座查询结果为:`+star)
        }
    })
})

program.parse(program.argv);