created by Austin Poor
A terminal task-list tool for Go. Inspired by the Node package listr and the AWS Copilot CLI.
Check out the documentation here! NOTE: The docs site is slightly out of date since some cool new features have been added! Check out this README for updated info and then check back with the docs later!
In a rush? Check out the Example section or the Examples directory!
- Multi-line updating lists print to the console
- Status updates live (with spinners while processing)
- Nested task groups
- Optionally run tasks concurrently
- Check if tasks should be skipped or should fail
- Safely print to stdout while the list is being displayed
- Update the task's message while running
- Truncate text output
- Optionally expand/collapse a task-group's subtasks when not running
- Optionally skip remaining tasks if one fails in a list or sub-group
go get github.com/a-poor/golist
- Standard library
- Go-MultiError, for returning multiple sub-task errors
Here's a quick example of golist
in action:
// Create a new list
l := golist.NewList()
// Add some tasks
l.AddTask(golist.NewTask("Get a pen", func(c golist.TaskContext) error {
time.Sleep(time.Second)
return nil
}))
l.AddTask(golist.NewTask("Get some paper", func(c golist.TaskContext) error {
time.Sleep(time.Second)
return nil
}))
l.AddTask(golist.NewTask("Write a novel", func(c golist.TaskContext) error {
time.Sleep(time.Second)
return nil
}))
// Run the tasks
l.RunAndWait()
Check out the examples folder for more examples of golist
in action!
Pull requests are super welcome! For major changes, please open an issue first to discuss what you would like to change. And please make sure to update tests as appropriate.
Or... feel free to just open an issue with some thoughts or suggestions or even just to say Hi and tell me if this library has been helpful!