mirror of
https://github.com/moparisthebest/curl
synced 2024-12-23 08:38:49 -05:00
docs/make: generate curl.1 from listed files only
Previously it rendered the page from files matching "*.d" in the correct directory, which worked fine in git builds when the files were added but made it easy to forget adding the files to the dist. Now, only man page sections listed in DPAGES in Makefile.inc will be used, thus "forcing" us to update this to get the man page right and get it included in the dist at the same time. Ref: #5146 Closes #5149
This commit is contained in:
parent
02174e41f5
commit
361d4f3fdc
@ -5,7 +5,7 @@
|
|||||||
# | (__| |_| | _ <| |___
|
# | (__| |_| | _ <| |___
|
||||||
# \___|\___/|_| \_\_____|
|
# \___|\___/|_| \_\_____|
|
||||||
#
|
#
|
||||||
# Copyright (C) 1998 - 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
# Copyright (C) 1998 - 2020, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||||
#
|
#
|
||||||
# This software is licensed as described in the file COPYING, which
|
# This software is licensed as described in the file COPYING, which
|
||||||
# you should have received as part of this distribution. The terms
|
# you should have received as part of this distribution. The terms
|
||||||
@ -31,4 +31,5 @@ EXTRA_DIST = $(DPAGES) MANPAGE.md gen.pl $(OTHERPAGES) CMakeLists.txt
|
|||||||
all: $(MANPAGE)
|
all: $(MANPAGE)
|
||||||
|
|
||||||
$(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc
|
$(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc
|
||||||
@PERL@ $(srcdir)/gen.pl mainpage $(srcdir) > $(MANPAGE)
|
@echo "generate $(MANPAGE)"
|
||||||
|
@(cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES)) > $(MANPAGE)
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
This script generates the manpage.
|
This script generates the manpage.
|
||||||
|
|
||||||
Example: gen.pl mainpage > curl.1
|
Example: gen.pl <command> [files] > curl.1
|
||||||
|
|
||||||
Dev notes:
|
Dev notes:
|
||||||
|
|
||||||
@ -37,12 +37,6 @@ Unfortunately it seems some perls like msysgit can't handle a global input-only
|
|||||||
=end comment
|
=end comment
|
||||||
=cut
|
=cut
|
||||||
|
|
||||||
my $some_dir=$ARGV[1] || ".";
|
|
||||||
|
|
||||||
opendir(my $dh, $some_dir) || die "Can't opendir $some_dir: $!";
|
|
||||||
my @s = grep { /\.d$/ && -f "$some_dir/$_" } readdir($dh);
|
|
||||||
closedir $dh;
|
|
||||||
|
|
||||||
my %optshort;
|
my %optshort;
|
||||||
my %optlong;
|
my %optlong;
|
||||||
my %helplong;
|
my %helplong;
|
||||||
@ -122,7 +116,7 @@ sub added {
|
|||||||
|
|
||||||
sub single {
|
sub single {
|
||||||
my ($f, $standalone)=@_;
|
my ($f, $standalone)=@_;
|
||||||
open(F, "<:crlf", "$some_dir/$f") ||
|
open(F, "<:crlf", "$f") ||
|
||||||
return 1;
|
return 1;
|
||||||
my $short;
|
my $short;
|
||||||
my $long;
|
my $long;
|
||||||
@ -262,7 +256,7 @@ sub single {
|
|||||||
|
|
||||||
sub getshortlong {
|
sub getshortlong {
|
||||||
my ($f)=@_;
|
my ($f)=@_;
|
||||||
open(F, "<:crlf", "$some_dir/$f");
|
open(F, "<:crlf", "$f");
|
||||||
my $short;
|
my $short;
|
||||||
my $long;
|
my $long;
|
||||||
my $help;
|
my $help;
|
||||||
@ -301,14 +295,15 @@ sub getshortlong {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub indexoptions {
|
sub indexoptions {
|
||||||
foreach my $f (@s) {
|
my (@files) = @_;
|
||||||
getshortlong($f);
|
foreach my $f (@files) {
|
||||||
}
|
getshortlong($f);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sub header {
|
sub header {
|
||||||
my ($f)=@_;
|
my ($f)=@_;
|
||||||
open(F, "<:crlf", "$some_dir/$f");
|
open(F, "<:crlf", "$f");
|
||||||
my @d;
|
my @d;
|
||||||
while(<F>) {
|
while(<F>) {
|
||||||
push @d, $_;
|
push @d, $_;
|
||||||
@ -347,12 +342,15 @@ sub listhelp {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub mainpage {
|
sub mainpage {
|
||||||
|
my (@files) = @_;
|
||||||
# show the page header
|
# show the page header
|
||||||
header("page-header");
|
header("page-header");
|
||||||
|
|
||||||
# output docs for all options
|
# output docs for all options
|
||||||
foreach my $f (sort @s) {
|
foreach my $f (sort @files) {
|
||||||
single($f, 0);
|
if(single($f, 0)) {
|
||||||
|
print STDERR "Can't read $f?\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
header("page-footer");
|
header("page-footer");
|
||||||
@ -379,33 +377,33 @@ sub showprotocols {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sub getargs {
|
sub getargs {
|
||||||
my $f;
|
my ($f, @s) = @_;
|
||||||
do {
|
if($f eq "mainpage") {
|
||||||
$f = shift @ARGV;
|
mainpage(@s);
|
||||||
if($f eq "mainpage") {
|
return;
|
||||||
mainpage();
|
}
|
||||||
return;
|
elsif($f eq "listhelp") {
|
||||||
}
|
listhelp();
|
||||||
elsif($f eq "listhelp") {
|
return;
|
||||||
listhelp();
|
}
|
||||||
return;
|
elsif($f eq "single") {
|
||||||
}
|
showonly($s[0]);
|
||||||
elsif($f eq "single") {
|
return;
|
||||||
showonly(shift @ARGV);
|
}
|
||||||
return;
|
elsif($f eq "protos") {
|
||||||
}
|
showprotocols();
|
||||||
elsif($f eq "protos") {
|
return;
|
||||||
showprotocols();
|
}
|
||||||
return;
|
|
||||||
}
|
|
||||||
} while($f);
|
|
||||||
|
|
||||||
print "Usage: gen.pl <mainpage/listhelp/single FILE/protos> [srcdir]\n";
|
print "Usage: gen.pl <mainpage/listhelp/single FILE/protos> [files]\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
# learn all existing options
|
my $cmd = shift @ARGV;
|
||||||
indexoptions();
|
my @files = @ARGV; # the rest are the files
|
||||||
|
|
||||||
getargs();
|
# learn all existing options
|
||||||
|
indexoptions(@files);
|
||||||
|
|
||||||
|
getargs($cmd, @files);
|
||||||
|
@ -40,7 +40,7 @@
|
|||||||
---------------------------------------------------------
|
---------------------------------------------------------
|
||||||
|
|
||||||
cd $srcroot/docs/cmdline-opts
|
cd $srcroot/docs/cmdline-opts
|
||||||
./gen.pl listhelp
|
./gen.pl listhelp *.d
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct helptxt {
|
struct helptxt {
|
||||||
|
Loading…
Reference in New Issue
Block a user