tool_listhelp: easier to generate with gen.pl

tool_listhelp.c is now a separate file with only the command line --help
output, exactly as generated by gen.pl. This makes it easier to generate
updates according to what's in the docs/cmdline-opts docs.

  cd $srcroot/docs/cmdline-opts
  ./gen.pl listhelp *.d > $srcroot/src/tool_listhelp.c

With a configure build, this also works:

  make -C src listhelp

Closes #7787
This commit is contained in:
Daniel Stenberg 2021-09-28 17:36:09 +02:00
parent d10a0af2f3
commit ffb634d4ef
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
9 changed files with 862 additions and 790 deletions

View file

@ -47,6 +47,7 @@ my %catlong;
use POSIX qw(strftime);
my $date = strftime "%B %d %Y", localtime;
my $year = strftime "%Y", localtime;
my $version = "unknown";
open(INC, "<../../include/curl/curlver.h");
@ -418,6 +419,42 @@ sub header {
}
sub listhelp {
print <<HEAD
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \\| |
* / __| | | | |_) | |
* | (__| |_| | _ <| |___
* \\___|\\___/|_| \\_\\_____|
*
* Copyright (C) 1998 - $year, Daniel Stenberg, <daniel@haxx.se>, et al.
*
* This software is licensed as described in the file COPYING, which
* you should have received as part of this distribution. The terms
* are also available at https://curl.se/docs/copyright.html.
*
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
* copies of the Software, and permit persons to whom the Software is
* furnished to do so, under the terms of the COPYING file.
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
* KIND, either express or implied.
*
***************************************************************************/
#include "tool_setup.h"
#include "tool_help.h"
/*
* DO NOT edit tool_listhelp.c manually.
* This source file is generated with the following command:
cd \$srcroot/docs/cmdline-opts
./gen.pl listhelp *.d > \$srcroot/src/tool_listhelp.c
*/
const struct helptxt helptext[] = {
HEAD
;
foreach my $f (sort keys %helplong) {
my $long = $f;
my $short = $optlong{$long};
@ -455,6 +492,11 @@ sub listhelp {
}
print $line;
}
print <<FOOT
{ NULL, NULL, CURLHELP_HIDDEN }
};
FOOT
;
}
sub listcats {