mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:43:34 +03:00
opt-docs: make sure all man pages have examples
Extended manpage-syntax.pl (run by test 1173) to check that every man page for a libcurl option has an EXAMPLE section that is more than two lines. Then fixed all errors it found and added examples. Reviewed-by: Daniel Gustafsson Closes #7656
This commit is contained in:
parent
c8210ef06d
commit
1731a77989
11 changed files with 237 additions and 16 deletions
|
|
@ -34,11 +34,28 @@ my $errors = 0;
|
|||
|
||||
sub scanmanpage {
|
||||
my ($file) = @_;
|
||||
my $reqex = 0;
|
||||
my $inex = 0;
|
||||
my $exsize = 0;
|
||||
|
||||
print "Check $file\n";
|
||||
open(M, "<$file") || die "no such file: $file";
|
||||
if($file =~ /\/CURL[^\/]*.3/) {
|
||||
# This is the man page for an libcurl option. It requires an example!
|
||||
$reqex = 1;
|
||||
}
|
||||
my $line = 1;
|
||||
while(<M>) {
|
||||
if($_ =~ /^.SH EXAMPLE/) {
|
||||
$inex = 1;
|
||||
}
|
||||
elsif($_ =~ /^.SH/) {
|
||||
$inex = 0;
|
||||
}
|
||||
elsif($inex) {
|
||||
$exsize++;
|
||||
}
|
||||
|
||||
if($_ =~ /^\'/) {
|
||||
print STDERR "$file:$line line starts with single quote!\n";
|
||||
$errors++;
|
||||
|
|
@ -57,6 +74,11 @@ sub scanmanpage {
|
|||
$line++;
|
||||
}
|
||||
close(M);
|
||||
|
||||
if($reqex && ($exsize < 2)) {
|
||||
print STDERR "$file:$line missing EXAMPLE section\n";
|
||||
$errors++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue