Skip to content

Commit

Permalink
tool_listhelp: easier to generate with gen.pl
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bagder committed Sep 29, 2021
1 parent 180180a commit 8588a26
Show file tree
Hide file tree
Showing 9 changed files with 860 additions and 790 deletions.
41 changes: 41 additions & 0 deletions docs/cmdline-opts/gen.pl
Expand Up @@ -47,6 +47,7 @@

use POSIX qw(strftime);
my $date = strftime "%b %e %Y", localtime;
my $year = strftime "%Y", localtime;
my $version = "unknown";

open(INC, "<../../include/curl/curlver.h");
Expand Down Expand Up @@ -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};
Expand Down Expand Up @@ -455,6 +492,10 @@ sub listhelp {
}
print $line;
}
print <<FOOT
};
FOOT
;
}

sub listcats {
Expand Down
3 changes: 3 additions & 0 deletions src/Makefile.am
Expand Up @@ -150,3 +150,6 @@ TIDY:=clang-tidy

tidy:
$(TIDY) $(CURL_CFILES) $(TIDYFLAGS) -- $(curl_CPPFLAGS) $(CPPFLAGS) -DHAVE_CONFIG_H

listhelp:
(cd $(top_srcdir)/docs/cmdline-opts && ./gen.pl listhelp *.d) > tool_listhelp.c
1 change: 1 addition & 0 deletions src/Makefile.inc
Expand Up @@ -73,6 +73,7 @@ CURL_CFILES = \
tool_homedir.c \
tool_hugehelp.c \
tool_libinfo.c \
tool_listhelp.c \
tool_main.c \
tool_msgs.c \
tool_operate.c \
Expand Down

0 comments on commit 8588a26

Please sign in to comment.