diff options
| author | Roman Smrž <roman.smrz@seznam.cz> | 2025-12-10 21:45:45 +0100 |
|---|---|---|
| committer | Roman Smrž <roman.smrz@seznam.cz> | 2025-12-11 20:42:45 +0100 |
| commit | 6beba62d56ab31927ef1ad7671ab52800ba51103 (patch) | |
| tree | 90d4a8b9e3e91c1b838ae1717fca25c1aa1f8d12 /src/Config.hs | |
| parent | 72c83a013caed4f3f850731988734d125df6a720 (diff) | |
Accept literal text block for the ‘shell’ section
Changelog: Accept literal text block for the `shell` section
Diffstat (limited to 'src/Config.hs')
| -rw-r--r-- | src/Config.hs | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/Config.hs b/src/Config.hs index fb3a828..40eb1e5 100644 --- a/src/Config.hs +++ b/src/Config.hs @@ -117,18 +117,23 @@ parseSingleCheckout = withMap "checkout definition" $ \m -> do parseMultipleCheckouts :: Node Pos -> Parser [ JobCheckout Declared ] parseMultipleCheckouts = withSeq "checkout definitions" $ fmap concat . mapM parseSingleCheckout -cabalJob :: Node Pos -> Parser [CreateProcess] +cabalJob :: Node Pos -> Parser [ Either CreateProcess Text ] cabalJob = withMap "cabal job" $ \m -> do ghcOptions <- m .:? "ghc-options" >>= \case Nothing -> return [] Just s -> withSeq "GHC option list" (mapM (withStr "GHC option" return)) s return - [ proc "cabal" $ concat [ ["build"], ("--ghc-option="++) . T.unpack <$> ghcOptions ] ] - -shellJob :: Node Pos -> Parser [CreateProcess] -shellJob = withSeq "shell commands" $ \xs -> do - fmap (map shell) $ forM xs $ withStr "shell command" $ return . T.unpack + [ Left $ proc "cabal" $ concat [ ["build"], ("--ghc-option="++) . T.unpack <$> ghcOptions ] ] + +shellJob :: Node Pos -> Parser [ Either CreateProcess Text ] +shellJob node = do + commands <- choice + [ withStr "shell commands" return node + , withSeq "shell commands" (\xs -> do + fmap T.unlines $ forM xs $ withStr "shell command" $ return) node + ] + return [ Right commands ] parseArtifacts :: Mapping Pos -> Parser [ ( ArtifactName, Pattern ) ] parseArtifacts m = do |