2022-03-23 04:40:31 +00:00
|
|
|
package uimodels
|
|
|
|
|
|
|
|
import "context"
|
|
|
|
|
2022-03-24 21:17:52 +00:00
|
|
|
type promptValueKeyType struct{}
|
|
|
|
|
2022-03-23 04:40:31 +00:00
|
|
|
var promptValueKey = promptValueKeyType{}
|
|
|
|
|
|
|
|
func PromptValue(ctx context.Context) string {
|
|
|
|
value, _ := ctx.Value(promptValueKey).(string)
|
|
|
|
return value
|
|
|
|
}
|
|
|
|
|
|
|
|
func WithPromptValue(ctx context.Context, value string) context.Context {
|
|
|
|
return context.WithValue(ctx, promptValueKey, value)
|
|
|
|
}
|