Skip to content

Commit

Permalink
docs(readme): add exec task description
Browse files Browse the repository at this point in the history
  • Loading branch information
bastean committed Sep 16, 2024
1 parent 0d22e16 commit 937c50f
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 43 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,10 @@ test-clean: generate-required
mkdir -p test/report

test-unit: test-clean
${bash} 'go test -v -cover ./pkg/context/... -run TestUnit.* |& tee test/report/unit.report.log'
${bash} 'go test -v -cover ./pkg/... -run TestUnit.* |& tee test/report/unit.report.log'

test-integration: test-clean
${bash} 'go test -v -cover ./pkg/context/... -run TestIntegration.* |& tee test/report/integration.report.log'
${bash} 'go test -v -cover ./pkg/... -run TestIntegration.* |& tee test/report/integration.report.log'

test-acceptance: test-clean
${bash} 'go test -v -cover ./internal/app/... -run TestAcceptance.* |& tee test/report/acceptance.report.log'
Expand Down
115 changes: 74 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ go install github.com/bastean/godo/cmd/godo@latest
### Usage

```bash
godo -h
godo
```

```text
Expand All @@ -43,53 +43,91 @@ _ / __ _ / / / __ / / /_ / / /
Predefined task runner.
Usage: godo [flags]
Usage:
godo [flags]
godo [command]
-task string
Name of the task to run (required)
```

## Package
Available Commands:
completion Generate the autocompletion script for the specified shell
exec Execute a list of tasks from a file
help Help about any command
### Download
Flags:
-h, --help help for godo
```bash
go get github.com/bastean/godo
Use "godo [command] --help" for more information about a command.
```

### Update
## Tasks

```bash
go get -u github.com/bastean/godo
```
### Exec

### Usage
Execute a list of tasks from a file, all tasks will be executed following the preset order in the configuration file, if any of the tasks fail, the following tasks will not be executed.

```go
package main
```bash
godo exec -c configs/example.exec.json
```

import (
"github.com/bastean/godo"
)
```text
Example tasks started!
Create a file
We will create a file and write something in it
(1/2) mkdir -p ignore
(2/2) bash -c echo "Example" > ignore/example.txt
File created!
Example tasks completed!
```

func main() {
godo.TODO()
[example.exec.json](configs/example.exec.json)

```json
{
"Tasks": [
{
"Success": "Example tasks started!"
},
{
"Title": "Create a file",
"Description": "We will create a file and write something in it",
"Commands": [
{
"Name": "mkdir",
"Args": ["-p", "ignore"]
},
{
"Name": "bash",
"Args": ["-c", "echo \"Example\" > ignore/example.txt"]
}
],
"Success": "File created!",
"Error": "File could not be created"
},
{
"Success": "Example tasks completed!"
}
]
}
```

## Tasks

### Run

-

### Sync

-

### Copy
Basic structure

```json
{
"Tasks": [
{
"Title": "",
"Description": "",
"Commands": [{ "Name": "", "Args": [""] }],
"Success": "",
"Error": ""
}
]
}
```

-
- `Success` is only displayed if the task has been successfully completed.
- `Error` is only displayed if an error occurred during the execution of the task.
- All fields in a task are optional.

## First Steps

Expand Down Expand Up @@ -139,13 +177,7 @@ make test-unit
make test-integration
```

##### Acceptance

```bash
make test-acceptance
```

##### Unit / Integration / Acceptance
##### Unit & Integration

```bash
make tests
Expand All @@ -156,6 +188,7 @@ make tests
#### Base

- [Go](https://go.dev)
- [Cobra](https://cobra.dev)

#### Please see

Expand Down

0 comments on commit 937c50f

Please sign in to comment.