Open caarlos0 opened 2 weeks ago
another idea would be to have a
type Spinner[T any] struct {
action func () T
// ..
and maybe a
type Spinner2[T any, Q any] struct {
action func() (T, Q)
}
the later being most commonly used as Spinner2[Something, error]
I would guess, maybe even worth making the second arg an error always.
@maaslalani I reworked some stuff:
action
as part as a tea.Cmd
I think it would be great to allow the spinner action to return an error, so it simplifies error handling in some cases.
this pr is wip to see what you think, if you think its a good idea, I'll work more on it.