From 130d4fedc7899a64aaa822e7dbe353013a75e992 Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Thu, 12 Aug 2021 16:55:37 +0200 Subject: [PATCH] action.Parent --- main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/main.go b/main.go index ee07430..7bcad43 100644 --- a/main.go +++ b/main.go @@ -47,6 +47,7 @@ type ActionConfig struct { OnError []ActionConfig `yaml:"onError"` _dirConf *DirectoryConfig + Parent *ActionConfig `yaml:"-"` } type DirectoryConfig struct { @@ -244,6 +245,7 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx) log.Printf("path: %s; action: %s; error %s", eventInfo.Path(), action.Id, err) for _, aE := range action.OnError { aE._dirConf = action._dirConf + aE.Parent = action _c, _ := runAction(&aE, eventInfo, ctx) contin = contin && _c if !contin { @@ -253,6 +255,7 @@ func runAction(action *ActionConfig, eventInfo notify.EventInfo, ctx actionCtx) } else { for _, aS := range action.OnSuccess { aS._dirConf = action._dirConf + aS.Parent = action _c, errS := runAction(&aS, eventInfo, ctx) contin = contin && _c if errS != nil {