kenote-task-helper
v1.1.5
Published
Task's Helper.
Downloads
1
Maintainers
Readme
task-helper
Task's Helper.
Installation
npm install kenote-task-helper
# Or
$ yarn add kenote-task-helper
Usages
task.ts
import { TaskHelper, Connect } from 'kenote-task-helper'
import initialize from './tasks/initialize'
import Reset from './tasks/reset'
@Connect({
title: '操作类型:',
tasks: [
{
name: '初始化',
value: 'initialize',
script: initialize
},
{
name: '重置',
value: 'reset',
script: Reset
},
{
name: '退出',
value: 'exit',
script: () => process.exit(0)
}
]
})
class Task extends TaskHelper {}
new Task().start()
task/initialize.ts
import { TaskSpinner } from 'kenote-task-helper'
export default async function initialize (): Promise<any> {
await Promise.all([
...
])
...
return TaskSpinner(Promise.resolve(`Initialize Finished.`))
}
Run
$ ts-node ./task.ts
? 选择操作类型:
1) 初始化
2) 重置
3) 退出
Answer: 1
License
this repo is released under the MIT License.