diff options
author | tv <tv@krebsco.de> | 2019-01-26 23:46:55 +0100 |
---|---|---|
committer | tv <tv@krebsco.de> | 2019-01-26 23:46:55 +0100 |
commit | bb4813de9bcd49a37f8e8871311e7201c6c7e29a (patch) | |
tree | 526f17adef215398b424fc1104aa011b7130c77e /src/Reaktor/Plugins/System | |
parent | 0395a9d9815d7d82469f0064738bef80ac87dbe3 (diff) |
Reaktor.Plugins.System: compile hPattern once
Diffstat (limited to 'src/Reaktor/Plugins/System')
-rw-r--r-- | src/Reaktor/Plugins/System/Internal.hs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/Reaktor/Plugins/System/Internal.hs b/src/Reaktor/Plugins/System/Internal.hs index 45b7329..aa60452 100644 --- a/src/Reaktor/Plugins/System/Internal.hs +++ b/src/Reaktor/Plugins/System/Internal.hs @@ -5,7 +5,8 @@ module Reaktor.Plugins.System.Internal where import Prelude.Extended import Data.Aeson import Reaktor () - +import Text.Regex.PCRE.Light (Regex) +import qualified Text.Regex.PCRE.Light as RE -- TODO this needs better names :) @@ -46,7 +47,7 @@ instance FromJSON Config where data Hook = Hook { hActivate :: Activate - , hPattern :: Maybe ByteString + , hPattern :: Maybe Regex , hCommand :: CaptureOr Command , hArguments :: [CaptureOr Text] , hWorkDir :: Maybe FilePath @@ -60,7 +61,7 @@ instance FromJSON Hook where Object v -> Hook <$> v .:? "activate" .!= Query - <*> v .:? "pattern" + <*> (fmap (flip RE.compile [RE.utf8]) <$> v .:? "pattern") <*> v .: "command" <*> v .:? "arguments" .!= [] <*> v .:? "workdir" |