Skip to content

Commit ffb634d

Browse files
committed
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 curl#7787
1 parent d10a0af commit ffb634d

File tree

9 files changed

+862
-790
lines changed

9 files changed

+862
-790
lines changed

docs/cmdline-opts/gen.pl

+42
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747

4848
use POSIX qw(strftime);
4949
my $date = strftime "%B %d %Y", localtime;
50+
my $year = strftime "%Y", localtime;
5051
my $version = "unknown";
5152

5253
open(INC, "<../../include/curl/curlver.h");
@@ -418,6 +419,42 @@ sub header {
418419
}
419420

420421
sub listhelp {
422+
print <<HEAD
423+
/***************************************************************************
424+
* _ _ ____ _
425+
* Project ___| | | | _ \\| |
426+
* / __| | | | |_) | |
427+
* | (__| |_| | _ <| |___
428+
* \\___|\\___/|_| \\_\\_____|
429+
*
430+
* Copyright (C) 1998 - $year, Daniel Stenberg, <daniel@haxx.se>, et al.
431+
*
432+
* This software is licensed as described in the file COPYING, which
433+
* you should have received as part of this distribution. The terms
434+
* are also available at https://curl.se/docs/copyright.html.
435+
*
436+
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
437+
* copies of the Software, and permit persons to whom the Software is
438+
* furnished to do so, under the terms of the COPYING file.
439+
*
440+
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
441+
* KIND, either express or implied.
442+
*
443+
***************************************************************************/
444+
#include "tool_setup.h"
445+
#include "tool_help.h"
446+
447+
/*
448+
* DO NOT edit tool_listhelp.c manually.
449+
* This source file is generated with the following command:
450+
451+
cd \$srcroot/docs/cmdline-opts
452+
./gen.pl listhelp *.d > \$srcroot/src/tool_listhelp.c
453+
*/
454+
455+
const struct helptxt helptext[] = {
456+
HEAD
457+
;
421458
foreach my $f (sort keys %helplong) {
422459
my $long = $f;
423460
my $short = $optlong{$long};
@@ -455,6 +492,11 @@ sub listhelp {
455492
}
456493
print $line;
457494
}
495+
print <<FOOT
496+
{ NULL, NULL, CURLHELP_HIDDEN }
497+
};
498+
FOOT
499+
;
458500
}
459501

460502
sub listcats {

src/Makefile.am

+3
Original file line numberDiff line numberDiff line change
@@ -150,3 +150,6 @@ TIDY:=clang-tidy
150150

151151
tidy:
152152
$(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H
153+
154+
listhelp:
155+
(cd $(top_srcdir)/docs/cmdline-opts && ./gen.pl listhelp *.d) > tool_listhelp.c

src/Makefile.inc

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ CURL_CFILES = \
7373
tool_homedir.c \
7474
tool_hugehelp.c \
7575
tool_libinfo.c \
76+
tool_listhelp.c \
7677
tool_main.c \
7778
tool_msgs.c \
7879
tool_operate.c \

0 commit comments

Comments
 (0)