gitee.com/liuxuezhan/go-micro-v1.18.0@v1.0.0/config/source/cli/options.go (about) 1 package cli 2 3 import ( 4 "context" 5 6 "github.com/micro/cli" 7 "gitee.com/liuxuezhan/go-micro-v1.18.0/config/source" 8 ) 9 10 type contextKey struct{} 11 12 // Context sets the cli context 13 func Context(c *cli.Context) source.Option { 14 return func(o *source.Options) { 15 if o.Context == nil { 16 o.Context = context.Background() 17 } 18 o.Context = context.WithValue(o.Context, contextKey{}, c) 19 } 20 }