Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions pkg/action/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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]
Expand All @@ -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,
})
Expand Down
1 change: 1 addition & 0 deletions pkg/action/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
}
Expand Down