diff --git a/pkg/action/action.go b/pkg/action/action.go index 7f65579..8fc6015 100644 --- a/pkg/action/action.go +++ b/pkg/action/action.go @@ -251,13 +251,13 @@ func (a *Action) SetInput(input *Input) (err error) { def := a.ActionDef() // Process arguments. - err = a.processInputParams(def.Arguments, input.Args(), input.ArgsChanged()) + err = a.processInputParams(def.Arguments, input.Args(), input.ArgsChanged(), input) if err != nil { return err } // Process options. - err = a.processInputParams(def.Options, input.Opts(), input.OptsChanged()) + err = a.processInputParams(def.Options, input.Opts(), input.OptsChanged(), input) if err != nil { return err } @@ -273,7 +273,7 @@ func (a *Action) SetInput(input *Input) (err error) { return a.EnsureLoaded() } -func (a *Action) processInputParams(def ParametersList, inp InputParams, changed InputParams) error { +func (a *Action) processInputParams(def ParametersList, inp InputParams, changed InputParams, input *Input) error { var err error for _, p := range def { _, isChanged := changed[p.Name] @@ -283,6 +283,7 @@ func (a *Action) processInputParams(def ParametersList, inp InputParams, changed res, err = handler(res, ValueProcessorContext{ ValOrig: inp[p.Name], IsChanged: isChanged, + Input: input, DefParam: p, Action: a, }) diff --git a/pkg/action/process.go b/pkg/action/process.go index b730bd7..1b48959 100644 --- a/pkg/action/process.go +++ b/pkg/action/process.go @@ -20,6 +20,7 @@ type ValueProcessor interface { type ValueProcessorContext struct { ValOrig any // ValOrig is the value before processing. IsChanged bool // IsChanged indicates if the value was input by user. + Input *Input // Input represents the associated action input in the current context. DefParam *DefParameter // DefParam is the definition of the currently processed parameter. Action *Action // Action is the related action definition. }