xenomachina / kotlin-argparser

Easy to use and concise yet powerful and robust command line argument parsing for Kotlin
GNU Lesser General Public License v2.1
485 stars 33 forks source link

Spaces should not be removed for --help prologue message #49

Open lamao opened 6 years ago

lamao commented 6 years ago

I want display table like message with several nested spaces for indentaion, e.g.

AA BB  .. CC
DD EE  .. FF
...........
F  G   .. H

But multiple spaces are removed - only one is printed. I get ugly table like this

AA BB .. CC
DD EE .. FF
...........
F G .. H
 @Test
    fun testPrologue() {
        val actual = "D  F".trimMargin().wrapText(80)
        assertEquals("D  F", actual)
    }
xenomachina commented 6 years ago

This is intended behavior, but you can at least work around the space collapsing issue by using non-breaking spaces:

val actual = "D\u00a0\u00a0F".trimMargin().wrapText(80)
assertEquals("D  F", actual)

There's still the issue of newlines, however. Newlines are treated like spaces, except (in the latest release) double-newlines are preserved, like in markdown.

Perhaps it makes sense to add some additional markdown-like behavior, like a way to preserve single newlines, or a way to have pre-formatted blocks.