Add opt-in PromptKit namespaces
This commit is contained in:
@@ -8,13 +8,14 @@ import (
|
||||
)
|
||||
|
||||
type concreteRequestInput[I any] struct {
|
||||
promptID string
|
||||
request ValidationRequest
|
||||
execution ExecutionInput
|
||||
resources ResourceInput
|
||||
inputs PromptInputs
|
||||
captured commandkit.FlagValues[I]
|
||||
selected I
|
||||
namespaces namespaceInput
|
||||
promptID string
|
||||
request ValidationRequest
|
||||
execution ExecutionInput
|
||||
resources ResourceInput
|
||||
inputs PromptInputs
|
||||
captured commandkit.FlagValues[I]
|
||||
selected I
|
||||
}
|
||||
|
||||
type requestValidationReport struct {
|
||||
@@ -46,6 +47,10 @@ func newConcreteRequestSpec[I, S any](suite Suite[I, S]) commandkit.CommandSpec[
|
||||
flags = append(flags, resources.Profile, resources.SessionID, inputs.Variable, inputs.Text, inputs.File)
|
||||
flags = append(flags, execution.All()...)
|
||||
|
||||
if suite.namespaces != nil {
|
||||
flags = append(flags, namespaceFlags(func(input **concreteRequestInput[I]) *namespaceInput { return &(*input).namespaces }, "prompt", "profile", "backend")...)
|
||||
}
|
||||
|
||||
return commandkit.CommandSpec[*concreteRequestInput[I]]{
|
||||
NewInput: func() *concreteRequestInput[I] {
|
||||
return &concreteRequestInput[I]{}
|
||||
@@ -62,6 +67,7 @@ func newConcreteRequestSpec[I, S any](suite Suite[I, S]) commandkit.CommandSpec[
|
||||
if input == nil {
|
||||
return errors.New("PromptKit request input must not be nil")
|
||||
}
|
||||
input.request.Namespaces = selectedNamespaces(suite.namespaces, input.namespaces)
|
||||
input.request.Request.ProfileID = input.resources.Profile.Value
|
||||
input.request.Request.SessionID = input.resources.SessionID.Value
|
||||
input.request.Request.Vars = input.inputs.Vars
|
||||
|
||||
Reference in New Issue
Block a user