go-micro.dev/v5@v5.12.0/config/source/cli/options.go (about) 1 package cli 2 3 import ( 4 "context" 5 6 "github.com/urfave/cli/v2" 7 "go-micro.dev/v5/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 }