language-docker icon indicating copy to clipboard operation
language-docker copied to clipboard

prettyPrint does not preseve the content of quoted string

Open bqcuong opened this issue 1 year ago • 0 comments

Hi there,

I have a similar problem to #57 with the prettyPrint for the quoted string. It is about prettyPrint automatically move the parts after token && to a new line even in a quoted string. The example code is described as below.

Is there any quick workarounds for this issue? I'm really looking forward to it. Thank you very much!

I am using language-docker-10.4.2.

module Main
  ( main
  ) where

import qualified Data.Either as Either
import qualified Data.Text as T
import qualified Data.Text.IO as T.IO
import qualified Data.Text.Lazy as Lazy
import qualified Language.Docker as Docker
import Prelude (IO, ($))

main :: IO ()
main = T.IO.putStr prettyPrinted
  where
    prettyPrinted = Lazy.toStrict $ Docker.prettyPrint parsed
    parsed = Either.fromRight [] $ Docker.parseText source
    source = T.pack "FROM alpine\nRUN grep -F 'cd dir && ./run.sh ' /opt/Makefile"

It should return

FROM alpine
RUN grep -F 'cd dir && ./run.sh ' /opt/Makefile

However, the actual return is as below, which creates different shell execution result.

FROM alpine
RUN grep -F 'cd dir \
 && ./run.sh ' /opt/Makefile

bqcuong avatar Apr 06 '23 23:04 bqcuong