]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
managen: verify the options used in example lines
authorDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 12:41:14 +0000 (14:41 +0200)
committerDaniel Stenberg <daniel@haxx.se>
Mon, 6 Oct 2025 21:17:33 +0000 (23:17 +0200)
Also fix the --knownhosts typo

Follow-up to aae18c4bdc1a3bf5

Reported-by: Daniel Terhorst-North
URL: https://mas.to/@tastapod/115327102344617386
Closes #18884

docs/cmdline-opts/knownhosts.md
scripts/managen
tests/data/test1705
tests/data/test1706

index 47095632df7a93d5813e53ae11eb3da9af06adc4..4b6386dd24ec32d2f2da6b75ecb6968825b922ea 100644 (file)
@@ -14,7 +14,7 @@ See-also:
   - insecure
   - key
 Example:
-  - --knownhost filename --key here $URL
+  - --knownhosts filename --key here $URL
 ---
 
 # `--knownhosts`
index 17c8677882d25725a09a10307932947a2b0837c5..0c75148fd170b59bf4c915a95ce4a4ed6c7be944 100755 (executable)
@@ -880,6 +880,29 @@ sub single {
     if($examples[0]) {
         my $s ="";
         $s="s" if($examples[1]);
+        foreach my $e (@examples) {
+            my $check = $e;
+            # verify the used options
+            for my $e (split(/ /, $check)) {
+                if($e =~ /^-([^- ])/) {
+                    my $opt = $1;
+                    if(!$optshort{$opt}) {
+                        print STDERR "$f:$line:1:ERROR: unknown option in ".
+                            "example: -$opt\n";
+                        return 2;
+                    }
+                }
+                elsif($e =~ /^--([^ =]*)/) {
+                    my $opt = $1;
+                    $opt =~ s/^expand-//g;
+                    if(!$helplong{$opt}) {
+                        print STDERR "$f:$line:1:ERROR: unknown option in ".
+                            "example: '--$opt'\n";
+                        return 2;
+                    }
+                }
+            }
+        }
         if($manpage) {
             print "\nExample$s:\n";
             print ".nf\n";
index 7c21ffa3493999942b92790e01c2abdb2efe5aa5..26ddf3d4ad19160ac429508a2207f84137b18455 100644 (file)
@@ -52,7 +52,7 @@ See-also:
   - trace
   - trace-ascii
 Example:
-  - --verbose $URL
+  - --fakeitreal $URL
 ---
 
 # `--verbose`
@@ -231,7 +231,7 @@ Disable it again with \-\-no-fakeitreal.
 
 Example:
 .nf
-curl --verbose https://example.com
+curl --fakeitreal https://example.com
 .fi
 
 This option is mutually exclusive with \fI\-\-trace\fP and \fI\-\-trace\-ascii\fP.
index 6362678e9adf1da96d39bf976a27473c41afdd77..f821618d277a71e56d860dc89bcbf46b6b643e6d 100644 (file)
@@ -52,7 +52,7 @@ See-also:
   - trace
   - trace-ascii
 Example:
-  - --verbose $URL
+  - --fakeitreal $URL
 ---
 
 # `--verbose`
@@ -196,7 +196,7 @@ DESCRIPTION
            effect. Disable it again with --no-fakeitreal.
 
            Example:
-            curl --verbose https://example.com
+            curl --fakeitreal https://example.com
 
            This option is mutually  exclusive with --trace and  --trace-ascii.
            See also --include, --silent, --trace and --trace-ascii.