]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
gen.pl: add '%GLOBALS' as a variable for mainpage
authorDaniel Stenberg <daniel@haxx.se>
Tue, 21 Feb 2023 16:17:49 +0000 (17:17 +0100)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 22 Feb 2023 07:36:21 +0000 (08:36 +0100)
And use it in page-header to list all global command line options.

docs/cmdline-opts/Makefile.am
docs/cmdline-opts/gen.pl
docs/cmdline-opts/page-header

index 0b5b29a127369a6734a9d4f657c6028e79636a27..5a8996bc227792c15b76ac30adceb3cc9f9d8f7f 100644 (file)
@@ -37,5 +37,5 @@ GN_ = $(GN_0)
 
 all: $(MANPAGE)
 
-$(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc
+$(MANPAGE): $(DPAGES) $(OTHERPAGES) Makefile.inc gen.pl
        $(GEN)(rm -f $(MANPAGE) && cd $(srcdir) && @PERL@ ./gen.pl mainpage $(DPAGES) > $(builddir)/manpage.tmp && mv $(builddir)/manpage.tmp $(MANPAGE))
index 8f0d636ca27fd0145f06c6651b33d0b5db662a2e..40bd1b6e1e85e3904f74a63384983c27ee23d817 100755 (executable)
@@ -51,6 +51,7 @@ use POSIX qw(strftime);
 my $date = strftime "%B %d %Y", localtime;
 my $year = strftime "%Y", localtime;
 my $version = "unknown";
+my $globals;
 
 open(INC, "<../../include/curl/curlver.h");
 while(<INC>) {
@@ -520,6 +521,7 @@ sub header {
     while(<F>) {
         s/%DATE/$date/g;
         s/%VERSION/$version/g;
+        s/%GLOBALS/$globals/g;
         push @d, $_;
     }
     close(F);
@@ -535,7 +537,7 @@ sub listhelp {
  *                            | (__| |_| |  _ <| |___
  *                             \\___|\\___/|_| \\_\\_____|
  *
- * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
+ * Copyright (C) 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
@@ -629,6 +631,36 @@ sub listcats {
     }
 }
 
+sub listglobals {
+    my (@files) = @_;
+    my @globalopts;
+
+    # Find all global options and output them
+    foreach my $f (sort @files) {
+        open(F, "<:crlf", "$f") ||
+            next;
+        my $long;
+        while(<F>) {
+            if(/^Long: *(.*)/i) {
+                $long=$1;
+            }
+            elsif(/^Scope: global/i) {
+                push @globalopts, $long;
+                last;
+            }
+            elsif(/^---/) {
+                last;
+            }
+        }
+        close(F);
+    }
+    return $ret if($ret);
+    for my $e (0 .. $#globalopts) {
+        $globals .= sprintf "%s--%s",  $e?($globalopts[$e+1] ? ", " : " and "):"",
+            $globalopts[$e],;
+    }
+}
+
 sub mainpage {
     my (@files) = @_;
     my $ret;
@@ -669,6 +701,7 @@ sub showprotocols {
 sub getargs {
     my ($f, @s) = @_;
     if($f eq "mainpage") {
+        listglobals(@s);
         mainpage(@s);
         return;
     }
index 3907460f12a80a7129eb8de944b6c558e8c9be95..acb9ef1f3dc735a8256a3da2deb774dffe0f3447 100644 (file)
@@ -201,3 +201,7 @@ prefix it with "no-". However, in this list we mostly only list and show the
 When --next is used, it resets the parser state and you start again with a
 clean option state, except for the options that are "global". Global options
 will retain their values and meaning even after --next.
+
+The following options are global:
+%GLOBALS.
+