0.2.1 • Published 2 years ago

@lc-cn/command v0.2.1

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

command

指令系统

Usage

1.安装

npm install @lc-cn/command

2.样例

import {defineCommand} from "@lc-cn/command";
function sleep(ms){
    return new Promise(resolve => {
        setTimeout(resolve,ms)
    })
}
const cmd=defineCommand('test <a> [b:number]')
    .option('hello','-h <who:number>')
    .option('world','-w')
    .action(async ({options},a,b)=>{
        console.log('我是传入的参数',[a,b])
        await sleep(3000)
        console.log('我3秒后返回')
        return options
    })
cmd.execute('test asdf 22 -h 你好 -w').then((res)=>{
    console.log(res)
}).catch(e=>{
    console.error(e.message)
})
0.2.1

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.9

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago