From 6beba62d56ab31927ef1ad7671ab52800ba51103 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roman=20Smr=C5=BE?= Date: Wed, 10 Dec 2025 21:45:45 +0100 Subject: =?UTF-8?q?Accept=20literal=20text=20block=20for=20the=20=E2=80=98?= =?UTF-8?q?shell=E2=80=99=20section?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Changelog: Accept literal text block for the `shell` section --- src/Config.hs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'src/Config.hs') 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 -- cgit v1.2.3