Files
influx-cli/pkg/cli/middleware/middleware.go

21 lines
486 B
Go

package middleware
import (
"github.com/urfave/cli"
)
// WithBeforeFns returns a cli.BeforeFunc that calls each of the provided
// functions in order.
// NOTE: The first function to return an error will end execution and
// be returned as the error value of the composed function.
func WithBeforeFns(fns ...cli.BeforeFunc) cli.BeforeFunc {
return func(ctx *cli.Context) error {
for _, fn := range fns {
if err := fn(ctx); err != nil {
return err
}
}
return nil
}
}