Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kenote/task-helper
Task's Helper
https://github.com/kenote/task-helper
inquirer nodejs task typescript
Last synced: about 15 hours ago
JSON representation
Task's Helper
- Host: GitHub
- URL: https://github.com/kenote/task-helper
- Owner: kenote
- License: mit
- Created: 2018-12-18T07:47:37.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-08-24T03:57:35.000Z (about 4 years ago)
- Last Synced: 2024-11-16T08:19:27.716Z (4 days ago)
- Topics: inquirer, nodejs, task, typescript
- Language: TypeScript
- Size: 33.2 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# task-helper
Task's Helper.
[![NPM Version][npm-image]][npm-url]
[![NPM Downloads][downloads-image]][downloads-url]
[![Build Status][travis-image]][travis-url]
[![Gratipay][licensed-image]][licensed-url]## Installation
```bash
npm install kenote-task-helper
# Or
$ yarn add kenote-task-helper
```## Usages
`task.ts`
```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`
```ts
import { TaskSpinner } from 'kenote-task-helper'export default async function initialize (): Promise {
await Promise.all([
...
])
...
return TaskSpinner(Promise.resolve(`Initialize Finished.`))
}
```## Run
```bash
$ ts-node ./task.ts? 选择操作类型:
1) 初始化
2) 重置
3) 退出
Answer: 1
```## License
this repo is released under the [MIT License](https://github.com/kenote/task-helper/blob/master/LICENSE).
[npm-image]: https://img.shields.io/npm/v/kenote-task-helper.svg
[npm-url]: https://www.npmjs.com/package/kenote-task-helper
[downloads-image]: https://img.shields.io/npm/dm/kenote-task-helper.svg
[downloads-url]: https://www.npmjs.com/package/kenote-task-helper
[travis-image]: https://travis-ci.com/kenote/task-helper.svg?branch=master
[travis-url]: https://travis-ci.com/kenote/task-helper
[licensed-image]: https://img.shields.io/badge/license-MIT-blue.svg
[licensed-url]: https://github.com/kenote/task-helper/blob/master/LICENSE