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
cmdline-opts: shorter help texts #13169
Conversation
curl 8.6.0
|
and now
|
Does scripts/completion.pl still work properly with this change?
|
I have no idea. Never used them, don't know how they work... 😮 |
From a manual inspection, I don't see anything special that this PR should break. |
src/tool_help.c
Outdated
else | ||
opt = 0; | ||
} | ||
printf(" %-*s %s\n", opt, helptext[i].opt, helptext[i].desc); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For some Windows consoles if the characters run to 80 then it makes the next line a blank line. for example here's what it looks like:
--crlfile <file> Certificate Revocation list
--curves <list> (EC) TLS key exchange algorithms to request
-d, --data <data> HTTP POST data
I think that the math needs to account for the spaces in the printf. But also I think there should be another space for the options that exceed the alignment and we end up with one space. here's what that looks like:
--request-target <path> Specify the target for this request
--resolve <[+]host:port:addr[,addr]...> Resolve host+port to address
--retry <num> Retry request if transient problems occur
cutting back a few columns:
diff --git a/src/tool_help.c b/src/tool_help.c
index 38a77f2..4e44f3a 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -91,21 +91,21 @@ static void print_category(curlhelp_t category)
if(len > longdesc)
longdesc = len;
}
- if(longopt + longdesc >= 80) {
+ if(longopt + longdesc >= 79) {
longdesc -= 3;
- longopt = 79 - longdesc;
+ longopt = 78 - longdesc;
}
for(i = 0; helptext[i].opt; ++i)
if(helptext[i].categories & category) {
int opt = (int)longopt;
size_t desclen = strlen(helptext[i].desc);
- if(opt + desclen >= 79) {
- if(desclen < 79)
- opt = 78 - (int)desclen;
+ if(opt + desclen >= 77) {
+ if(desclen < 77)
+ opt = 76 - (int)desclen;
else
opt = 0;
}
- printf(" %-*s %s\n", opt, helptext[i].opt, helptext[i].desc);
+ printf(" %-*s %s\n", opt, helptext[i].opt, helptext[i].desc);
}
}
--crlfile <file> Certificate Revocation list
--curves <list> (EC) TLS key exchange algorithms to request
-d, --data <data> HTTP POST data
--request-target <path> Specify the target for this request
--resolve <[+]host:port:addr[,addr]...> Resolve host+port to address
--retry <num> Retry request if transient problems occur
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could maybe save the fine tuning for #13171...
|
In an effort to increase the readability of the "--help all" output on narrow (80 column) terminals. Closes #13169
7517333
to
056e401
Compare
update
|
I think a cert-status description of "OCSP-staple the server" is unclear so I changed it to something longer, however in the case of DoH it is a little longer than I would like but I couldn't think of a better way to say it. Here's what it looks like now (on windows):
edit: maybe get rid of the word via?
|
In an effort to increase the readability of the "--help all" output on narrow (80 column) terminals. Co-authored-by: Jay Satiro Closes #13169
63fd430
to
dc99dc1
Compare
In an effort to increase the readability of the "--help all" output on narrow (80 column) terminals.