Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
edoger committed Nov 29, 2020
1 parent c2e8eb6 commit d933565
Showing 1 changed file with 25 additions and 26 deletions.
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,34 @@ This package is a library of ZKits project.
This library provides a convenient subtask runner for applications.
We can easily control the running order of subtasks and exit them in reverse order.

## Install ##

```sh
go get -u -v github.com/edoger/zkits-runner
```

## Usage ##

1. Import package.

```sh
go get -u -v github.com/edoger/zkits-runner
```

2. Create a runner to run subtasks within the application.

```go
package main
import (
"github.com/edoger/zkits-runner"
)
func main() {
r := runner.New()
err := r.Run(runner.NewTaskFromFunc(nil, func() error {
// Do something.
return nil
}))
// Wait system exit.
if err := r.Wait(); err != nil {
// Handle error.
}
```go
package main

import (
"github.com/edoger/zkits-runner"
)

func main() {
r := runner.New()
err := r.Run(runner.NewTaskFromFunc(nil, func() error {
// Do something.
return nil
}))

// Wait system exit.
if err := r.Wait(); err != nil {
// Handle error.
}
```
}
```

## License ##

Expand Down

0 comments on commit d933565

Please sign in to comment.