Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

description newline stripping #376

Open
lrstanley opened this issue Aug 15, 2023 · 2 comments
Open

description newline stripping #376

lrstanley opened this issue Aug 15, 2023 · 2 comments

Comments

@lrstanley
Copy link

Looks as though description newlines are stripped, which means printing any type of structured output inside of descriptions will break. It looks like this is due to description being added to help, and thus help being passed into the line wrapping functionality causes it to trim those things.

Some examples of things that I've seen other cli tools have in their "about/description":

  • ASCII logo art
  • licenses (by themselves I guess don't require non-wrapping, in many scenarios, but do span many lines, and can complicate things if mixed with other description output)
  • version/build/author/link info (see example below)

I guess my question is, does this make sense to have as a supported feature? If so, should it be toggleable? E.g. kong.Description() and kong.LongDescription() or kong.FormattedDescription(), maybe (with a warning that it won't obey wrapping?)?

@alecthomas
Copy link
Owner

Kong's help output is fed through Go's doc formatter. I think I did that primarily to support line wrapping and integration, but I do agree that makes it difficult to control the output.

@andrewbaxter
Copy link
Contributor

I had a comment about Help() command methods, then deleted it because I thought it might be user error, but it seems still there.

Indenting lines with a few spaces seemed to get go to avoid doing further formatting. Is go's doc formatter markdown or something?

Anyway, my use case is I wanted to add a yaml snippet in the command help text (command takes a yaml file).

The normal behavior seems fine for most things, but a way to get out of it would be helpful for that. That said, I don't think I realized it was formatting it at all, so in my own use case I don't rely on the formatting currently.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants