How can I disable the display of blank new lines after help? #4745
-
After I upgrade clap from v2 to v3. I found it always prints a new line after help. How can I disable it? ➜ rustup git:(bump-clap) ✗ ./target/debug/rustup-init show -h
error: error: Found argument 'show' which wasn't expected, or isn't valid in this context
USAGE:
rustup-init [OPTIONS]
For more information try --help
➜ rustup git:(bump-clap) ✗ What I expected: ➜ rustup git:(bump-clap) ✗ ./target/debug/rustup-init show -h
error: error: Found argument 'show' which wasn't expected, or isn't valid in this context
USAGE:
rustup-init [OPTIONS]
For more information try --help
➜ rustup git:(bump-clap) ✗ |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Can you verify if there is just 1 trailing CLI programs should always output at least one trailing There were cases at various times where clap did not have a trailing |
Beta Was this translation helpful? Give feedback.
-
Oh, I see. We added a Thank you! |
Beta Was this translation helpful? Give feedback.
Can you verify if there is just 1 trailing
\n
or 2 by clap by piping to a file and checking the raw bytes?CLI programs should always output at least one trailing
\n
Traditionally, not doing this would cause the prompt to be on the same line as the last line of the program. Some modern prompts intentionally add a blank line before the prompt so well-formed CLIs will lead to a blank line between the CLI and the prompt. For instance, I'm using starship andcargo check
,git push
, etc have a blank line between them and the prompt.There were cases at various times where clap did not have a trailing
\n
and we fixed up a lot of cases. My hope is that this is more of your prompt also adding a\n
,…