-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🎨 show off multi-task functionality in the readme
- Loading branch information
Showing
8 changed files
with
279 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"github.com/fumeapp/taskin" | ||
"time" | ||
) | ||
|
||
func main() { | ||
|
||
tasks := taskin.New(taskin.Tasks{ | ||
{ | ||
Title: "Mow the lawn", | ||
Task: func(t *taskin.Task) error { | ||
for i := 0; i < 3; i++ { | ||
t.Title = fmt.Sprintf("Mow the lawn: [%d/3] passes", i+1) | ||
time.Sleep(500 * time.Millisecond) | ||
} | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Title: "Pluck the Chickens", | ||
Tasks: taskin.Tasks{ | ||
{ | ||
Title: "Pluck the silkies", | ||
Task: func(t *taskin.Task) error { | ||
for i := 0; i < 3; i++ { | ||
t.Title = fmt.Sprintf(" [%d/3] silkies plucked", i+1) | ||
time.Sleep(500 * time.Millisecond) | ||
} | ||
return nil | ||
}, | ||
}, | ||
{ | ||
Title: "Pluck the leghorns", | ||
Task: func(t *taskin.Task) error { | ||
for i := 0; i < 3; i++ { | ||
t.Title = fmt.Sprintf(" [%d/3] leghorns plucked", i+1) | ||
time.Sleep(500 * time.Millisecond) | ||
} | ||
return nil | ||
}, | ||
}, | ||
}, | ||
}, | ||
{ | ||
Title: "Paint the house", | ||
Task: func(t *taskin.Task) error { | ||
for i := 0; i < 3; i++ { | ||
t.Progress(i+1, 5) | ||
t.Title = fmt.Sprintf("Paint the house: [%d/3] walls painted", i+1) | ||
time.Sleep(500 * time.Millisecond) | ||
} | ||
return nil | ||
}, | ||
}, | ||
}, taskin.Defaults) | ||
err := tasks.Run() | ||
|
||
if err != nil { | ||
panic(err) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.