# react-lyl-cli

> react-cli

Latest version **0.0.1** (published 2021-08-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install react-lyl-cli
pnpm add react-lyl-cli
yarn add react-lyl-cli
bun add react-lyl-cli
```

Provides the command `react-lyl-cli`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.1 |
| Published | 2021-08-23 |
| First published | 2021-08-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 111.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | lyl |
| Maintainers | lyl1192511438 |
| Keywords | typescript, react, cli |

## Links

- npm: https://www.npmjs.com/package/react-lyl-cli
- npm.io page: https://npm.io/package/react-lyl-cli

## Dependencies (4)

- [chalk](https://npm.io/package/chalk.md) ^4.1.2
- [which](https://npm.io/package/which.md) ^2.0.2
- [inquirer](https://npm.io/package/inquirer.md) ^8.1.2
- [commander](https://npm.io/package/commander.md) ^8.1.0

## Recent versions

- 0.0.1 (latest) — 2021-08-23

## README

# commander使用

### option
```js
    .option("-n, --name[items2]",'name description','default value')

    //如果没有参数 --name ,则program.opts()  --返回true   如果有参数 返回参数

```


### command

```js

    .command(名字<参数>).action(方法)
    参数回传给对应的action
```


### inquirer

inquirer.prompt([]).then().catch()

问题对象具体配置项：
    type ：input，number，confirm， list，rawlist，expand，checkbox，password，editor
    name :将答案存储在答案哈希中时使用的名称
    message :问题
    default：默认值
    choices
    validate
    filter
    transformer
    when：（Function，Boolean）接收当前用户的答案哈希，并应返回true或false取决于是否应询问此问题。该值也可以是一个简单的布尔值



```js
    inquirer.prompt([ {
  type: 'number', 
  name: 'number', 
  message: 'How much do you need?', 
  default: 1
}]).then((answers) => { 
  console.log('结果为:')
  console.log(answers)
})

inquirer.prompt([ {
  type: 'input', 
  name: 'size', 
  message: 'Select size: large, medium and small', 
  default: 'medium'
}]).then((answers) => { 
  console.log('结果为:')
  console.log(answers)
})

inquirer.prompt([ {
  type: 'list', 
  name: 'list', 
  message: 'What do you like to drink?', 
  choices: ['black-tea', 'green-tea', 'milk-tea'],
  default: 1
}]).then((answers) => { 
  console.log('结果为:')
  console.log(answers)
})

inquirer.prompt([ { 
  type: 'checkbox', 
  name: 'checkbox', 
  message: 'What do you like to drink?', 
  choices: ['black-tea', 'green-tea', 'milk-tea', new inquirer.Separator(), 'juice'], //可以在数组中插入分割符
  default: ['black-tea'] //这里需要用数组,不能像list一样用下标
}]).then((answers) => { 
  console.log('结果为:')
  console.log(answers)
})

inquirer.prompt([ { //当类型为confirm时，各配置项示例
    type: 'password', 
    name: 'password', 
    message: 'Please input password:', 
    mask: true
  }]).then((answers) => { 
    console.log('结果为:')
    console.log(answers)
  })


```


process.platform 属性返回字符串，用于标识运行 Node.js 进程的操作系统平台。

---
_Source: https://npm.io/package/react-lyl-cli · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
