Skip to content

Pretty printing of RUN in shell form replaces multiple spaces in quoted string #57

Open
@evolutics

Description

@evolutics

First of all, thanks for this helpful library.

The Dockerfile

FROM alpine
RUN echo 'a    b'

is pretty printed by prettyPrint as

FROM alpine
RUN echo 'a b'

I'd expect a quoted string to be left unchanged instead of reduced to 'a b'.

This happens not only with RUN instructions (in shell form), but also with health check commands.

A minimal code example is

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 echo 'a    b'\n"

I'm using version 9.1.1 of the library (via LTS Haskell 16.18).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions