项目文件夹

文件

项目文件夹

0
T

21 行
365 B
Go

2019-05-30 23:11:13 +01:00
package cli
import (
"context"
"github.com/urfave/cli/v2"
"go-micro.dev/v6/config/source"
2019-05-30 23:11:13 +01:00
)
type contextKey struct{}
2022-09-30 16:27:07 +02:00
// Context sets the cli context.
2019-05-30 23:11:13 +01:00
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)
}
}