Devendra174's picture
Upload folder using huggingface_hub
1e92f2d verified
raw
history blame contribute delete
479 Bytes
package expflag
import "context"
type flagSetKeyT struct{}
var flagSetKey flagSetKeyT
// Context returns a new context with the given FlagSet.
func Context(ctx context.Context, fs FlagSet) context.Context {
return context.WithValue(ctx, flagSetKey, fs)
}
// ContextHas returns true if the given context has the given flag.
func ContextHas(ctx context.Context, flag Flag) bool {
fs, ok := ctx.Value(flagSetKey).(FlagSet)
if !ok {
return false
}
return fs.Has(flag)
}