项目文件夹

文件
asim 610c00859f v5
2024-06-04 21:40:43 +01:00

21 行
365 B
Go

package cli
import (
"context"
"github.com/urfave/cli/v2"
"go-micro.dev/v5/config/source"
)
type contextKey struct{}
// Context sets the cli context.
func Context(c *cli.Context) source.Option {
return func(o *source.Options) {
if o.Context == nil {
o.Context = context.Background()
}
o.Context = context.WithValue(o.Context, contextKey{}, c)
}
}