-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Add blank line between items in long help #1642
Comments
Not sure about the default behavior, but sounds like we can make a global setting for it. |
Hmm, I just thought that, regardless of the default, it should probably be consistent, so if |
I don't think there should be a setting for this. Blank line between flags and options should exist since it's a standard. |
For |
Hmm.. Doing
Maybe this is occurring when long help messages are multi line only. Wonder what happens with a mix of them. |
I propose:
|
Shouldn't there be 3 options? I think I propose an additional As well, how should we define one-line helps? Is it according to the terminal width? Is it according to 80 characters width? Or according to It may looks bad too if the terminal is very wide and one-line helps without blank lines that is too long may hard readability (looking at Having it too short without blank lines is bad too (looking at
|
I agree regarding the auto. I think we are checking terminal width somewhere in the code. |
@pickfire If you want something easy to pick up, this issue should be good to go 😄 |
@pksunkara Yes, this issue seemed easy but the discussion is not complete so I am thinking to take it later once things become clearer. |
@pickfire I believe both @pksunkara and I agree on the design you described in a comment above. Regarding to aligning to the terminal's width - let's just start working on it and see what tools we have available at our disposal. |
struct Flags: u64 {
const BLANK_LINE_ALWAYS = 1 << 42;
const BLANK_LINE_AUTO = 1 << 43; Can we only keep two flag since we can use just two flags to represent 3 of the real flags which can save up some bits for the future? Similar this can be applied to @CreepySkeleton I planned to change it to |
That would be cool. Regarding to concrete representation, I truly believe that the decision here should not be based on "let's save a few bits/bytes" considerations. This bitfield is not part of public API, if we decide that I kind of don't know what would be the best solution here. The problem here is: bits are wery suitable for representing binary yes/no values, but the setting in question has three values, yes/no/detect. Bitflags don't really fit. Maybe a separate enum? @kbknapp @pksunkara any ideas? |
Perhaps I'm under-thinking it, but I don't think this should be consumer configurable. These rules seem pretty simple and rely on already implemented rules of just determining if multi-line help should be displayed or not:
The issue described by @casey seems to only appear if the So I think this is actually a bug. While testing for this I found what I would maybe deem a bug when the Edit: See the last example of #1891 to see the bug from this issue in action. Make the |
That three values could be fitted into two bytes since only one of of the three can be used, so it is either the following options:
And also, we can just read 2 bytes, of course it is already in memory but I don't see why we do that since it is not possible to have auto but with the other flag set. |
Since this is now a bug and not an enhancement, we don't need the flags at all. |
@pksunkara Err, so what should I do here? Anything that I can help with? |
Try to fix the bug? In the test case of first comment of this issue, there should always be an empty line. |
@casey Can we see the source code for the output? Are you perhaps using Arg::new("arg")
.long_help("help help help help") Or do you do it? Arg::new("arg")
.long_help("help help help help
") |
I no longer use |
I believe the issue is related to fn blank_lines_between_long_help() {
let app = App::new("myapp").arg(Arg::new("unstable").short('u').about(
"Enable unstable features. To avoid premature stabilization and
excessive version churn, unstable features are unavailable unless this flag is
set. Unstable features are not bound by semantic versioning stability
guarantees, and may be changed or removed at any time.",
));
assert!(utils::compare_output(
app,
"myapp --help",
ISSUE_1642_LONG_HELP,
false
));
} |
Any updates on this issue? @pickfire it sounded like you were working on it, but the discussion here trailed off and I can't find any related pull requests so I'm assuming it's up for grabs? @pksunkara / @kbknapp / @CreepySkeleton is the consensus still that this is a bug and that a fix without a setting would be acceptable? BTW, the It says the output for the example code looks like this:
But if you try that exact code with clap 2.33.2, what you actually see is this:
(Without an empty line before |
@mkantor Go ahead and work on the issue. Yes, it's still a bug. Regarding the long_help doc, please check master instead of v2.33 on docs.rs. |
Bam! #2058 |
@mkantor I was working on it but I couldn't reproduce it so I stopped working on it. |
Currently, items in a long help message sometimes have a blank line between them, and sometimes run together. Compare this output from clap:
With this output from
man man
:It might be easier to visually parse if the items in a long help message were always separated by a blank line.
The text was updated successfully, but these errors were encountered: