-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
When you have to configure global dependencies like the logger, you currently need to wrap the runners
func wrap(fn func(ctx context.Context) error) func(ctx context.Context) error {
return func(ctx context.Context) error {
return fn(ctx)
}
}
// usage
cmd.Run(wrap(func(ctx context.Context) error {
return c.Download(ctx, in)
}))This isn't bad, but it'd be nice to able to just call cmd.Use(...).Run(...) to configure "middleware". Ideally you could do it higher up, so you don't need to do it for every command.
Metadata
Metadata
Assignees
Labels
No labels