Handle linebreaks in custom completions.#1162
Conversation
|
@marckhouzam Please take a look. |
|
@Luap99 Interesting find! What do you think would be best for a user:
I'm asking because I wondered if truncating a description would remove useful information. |
|
@marckhouzam Here are two examples I found in the podman project: I would argue that the first line should contain enough information to understand what a command/flag does. If someone wants the full information they should use the man pages or --help. |
marckhouzam
left a comment
There was a problem hiding this comment.
I tested this and it works great. Just a couple of nits on the comments.
Thanks!
ce7aad9 to
52f8696
Compare
If a command/flag description contains a linebreak then the shell completion script will interpret this as new command/flag. To fix this we only use the first line from the description in the output. Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
52f8696 to
86f532b
Compare
|
LGTM /cc @jharshman |
jpmcb
left a comment
There was a problem hiding this comment.
Thanks for this fix! LGTM 🎸
If a command/flag description contains a linebreak than the shell completion script will interpret this as new command/flag.
To fix this we should only use the first line from the description in the output.
e.g.
cmd.Flags().String("flag", "", "Description for flag\nlonger description")