cmdline-opts: category cleanup

Option cleanups:

 --get is not upload
 --form* are post
 - added several options into ldap, smtp, imap and pop3
 - shortened the category descriptions in the list

category curl fixes:

 --create-dirs removed from 'curl'
 --ftp-create-dirs removed from 'curl'
 --netrc moved to 'auth' from 'curl'
 --netrc-file moved to 'auth' from 'curl'
 --netrc-optional moved to 'auth' from 'curl'
 --no-buffer moved to 'output' from 'curl'
 --no-clobber removed from 'curl'
 --output removed from 'curl'
 --output-dir removed from 'curl'
 --remove-on-error removed from 'curl'

Add a "global" category:

- Made all "global" options set this category

Add a "deprecated" category:

- Moved the deprecated options to it (maybe they should not be in any
 category long term)

Add a 'timeout' category

- Put a number of appropriate options in it

Add an 'ldap' category

- Put the LDAP related option in there

Remove categories "ECH" and "ipfs"

- They should not be categories. Had only one single option each.

Remove category "misc"

- It should not be a category as it is impossible to know when to browse
  it.

--use-ascii moved to ftp and output
--xattr moved to output
--service-name moved to auth

Managen fixes:

- errors if an option is given a category name that is not already setup
  for in code

- verifies that options set `scope: global` also is put in category
  `global´

Closes #14101
This commit is contained in:
Daniel Stenberg 2024-07-04 13:38:18 +02:00
parent 18c61aa036
commit 2abfc759b9
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
64 changed files with 239 additions and 204 deletions

View file

@ -667,6 +667,10 @@ sub single {
my $pre = $manpage ? "\n": "[1]";
if($scope) {
if($category !~ /global/) {
print STDERR "$f:$line:1:ERROR: global scope option does not have global category\n";
return 2;
}
if($scope eq "global") {
push @desc, "\n" if(!$manpage);
push @desc, "${pre}This option is global and does not need to be specified for each use of --next.\n";
@ -885,7 +889,25 @@ sub header {
printdesc($manpage, 0, @d);
}
sub sourcecategories {
my ($dir) = @_;
my %cats;
open(H, "<$dir/../../src/tool_help.h") ||
die "can't find the header file";
while(<H>) {
if(/^\#define CURLHELP_([A-Z0-9]*)/) {
$cats{lc($1)}++;
}
}
close(H);
return %cats;
}
sub listhelp {
my ($dir) = @_;
my %cats = sourcecategories($dir);
print <<HEAD
/***************************************************************************
* _ _ ____ _
@ -938,6 +960,12 @@ HEAD
$opt = " --$long";
}
for my $i (0 .. $#categories) {
if(!$cats{ $categories[$i] }) {
printf STDERR "$f.md:ERROR: Unknown category '%s'\n",
$categories[$i];
exit 3;
}
$bitmask .= 'CURLHELP_' . uc $categories[$i];
# If not last element, append |
if($i < $#categories) {
@ -963,7 +991,7 @@ HEAD
print $line;
}
print <<FOOT
{ NULL, NULL, CURLHELP_HIDDEN }
{ NULL, NULL, 0 }
};
FOOT
;
@ -982,9 +1010,9 @@ sub listcats {
push @categories, $key;
}
@categories = sort @categories;
unshift @categories, 'hidden';
for my $i (0..$#categories) {
print '#define ' . 'CURLHELP_' . uc($categories[$i]) . ' ' . "1u << " . $i . "u\n";
printf("#define CURLHELP_%-10s (%s)\n",
uc($categories[$i]), "1u << ${i}u");
}
}
@ -1129,7 +1157,7 @@ sub getargs {
return;
}
elsif($f eq "listhelp") {
listhelp();
listhelp($dir);
return;
}
elsif($f eq "single") {