master
1#!/usr/bin/env perl
2# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
3#
4# SPDX-License-Identifier: curl
5#
6# Input: cmdline docs markdown files, they get modified *in place*
7#
8# Strip off the leading meta-data/header part, remove all known curl symbols
9# and long command line options. Also clean up whatever else the spell checker
10# might have a problem with that we still deem is fine.
11#
13use strict;
14use warnings;
16my @asyms;
18open(S, "<", './docs/libcurl/symbols-in-versions')
19 or die "cannot find symbols-in-versions";
20while(<S>) {
21 if(/^([^ ]*) /) {
22 push @asyms, $1;
23 }
24}
25close(S);
27# init the opts table with "special" options not easy to figure out
28my @aopts = (
29 '--ftp-ssl-reqd', # old alias
30 );
32open(O, "<", './docs/options-in-versions')
33 or die "cannot find options-in-versions";
34while(<O>) {
35 chomp;
36 if(/^([^ ]+)/) {
37 my $o = $1;
38 push @aopts, $o;
39 if($o =~ /^--no-(.*)/) {
40 # for the --no options, also make one without it
41 push @aopts, "--$1";
42 }
43 elsif($o =~ /^--disable-(.*)/) {
44 # for the --disable options, also make the special ones
45 push @aopts, "--$1";
46 push @aopts, "--no-$1";
47 }
48 }
49}
50close(O);
52open(C, "<", './.github/scripts/spellcheck.curl')
53 or die "cannot find spellcheck.curl";
54while(<C>) {
55 if(/^\#/) {
56 next;
57 }
58 chomp;
59 if(/^([^ ]+)/) {
60 push @asyms, $1;
61 }
62}
63close(C);
65# longest symbols first
66my @syms = sort { length($b) <=> length($a) } @asyms;
68# longest cmdline options first
69my @opts = sort { length($b) <=> length($a) } @aopts;
71sub process {
72 my ($f) = @_;
74 my $ignore = 0;
75 my $sepcount = 0;
76 my $out;
77 my $line = 0;
78 open(F, "<", $f) or die;
80 while(<F>) {
81 $line++;
82 if(/^---/ && ($line == 1)) {
83 $ignore = 1;
84 next;
85 }
86 elsif(/^---/ && $ignore) {
87 $ignore = 0;
88 next;
89 }
90 next if($ignore);
92 my $l = $_;
94 # strip out backticked words
95 $l =~ s/`[^`]+`//g;
97 # **bold**
98 $l =~ s/\*\*(\S.*?)\*\*//g;
99 # *italics*
100 $l =~ s/\*(\S.*?)\*//g;
102 # strip out https URLs, we do not want them spellchecked
103 $l =~ s!https://[a-z0-9\#_/.-]+!!gi;
105 # strip links, both name and target
106 $l =~ s/(\[.*?\])\(.*?\)//g;
107 $out .= $l;
108 }
109 close(F);
111 # cut out all known curl cmdline options
112 map { $out =~ s/$_//g; } (@opts);
114 # cut out all known curl symbols
115 map { $out =~ s/\b$_\b//g; } (@syms);
117 if(!$ignore) {
118 open(O, ">", $f) or die;
119 print O $out;
120 close(O);
121 }
122}
124my @filemasks = @ARGV;
125open(my $git_ls_files, '-|', 'git', 'ls-files', '--end-of-options', @filemasks) or die "Failed running git ls-files: $!";
126while(my $f = <$git_ls_files>) {
127 chomp $f;
128 process($f);
129}
130close $git_ls_files;
Diagnostics4 git calls · 51 ms
CallStatusSizeTime051 ms
discover200152 B2 ms
git.upload-pack discover http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=152 git.server.agent=gitty/1.0 git.server.object_format=sha1 git.server.caps=agent ls-refs fetch object-format git.server.fetch=shallow filter sideband-all git.protocol.version=2 git.pkt.frames=8 git.pkt.data=6 git.pkt.flush=2 git.pkt.delim=0 git.pkt.bytes=152 git.pkt.payload.max=34
ls-refs200149 B · hit2 ms
git.upload-pack ls-refs http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=ls-refs git.upstream.dur_ms=2 git.response.bytes=149 git.response.cache=HIT git.response.duration_ms=2 git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=149 git.pkt.payload.max=78 git.ls_refs.count=2 git.ls_refs.head=refs/heads/master
fetchblob:none · deepen 10200287 KiB · hit26 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=3 git.response.bytes=293470 git.response.cache=HIT git.response.duration_ms=26 git.fetch.filter=blob:none git.fetch.filter.requested=tree:0 git.fetch.filter.fallback=blob:none git.fetch.filter.learned=false git.fetch.wants=31c911efe5652725e930f4d2e60c9060e5f6646d git.fetch.haves.count=0 git.fetch.deepen=10 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=10 git.pkt.data=8 git.pkt.flush=1 git.pkt.delim=1 git.pkt.bytes=293470 git.pkt.payload.max=65516 git.sideband.band1.bytes=293354 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0 git.pack.objects=87 git.pack.bytes=293354 git.pack.ofs_delta=0 git.pack.ref_delta=1 git.pack.chain.max=1 git.pack.trailer=6a646bcda6740bab42e321b51998b52ea15146c0 git.pack.full=86Open pack map
fetch2001.3 KiB · hit23 ms
git.upload-pack fetch http.response.status_code=200 git.upstream.cf_ray=- git.upstream.phase=fetch git.upstream.dur_ms=23 git.response.bytes=1317 git.response.cache=HIT git.response.duration_ms=23 git.fetch.wants=c362484054aa30f96efa0924039c4db4a3913cd1 git.fetch.haves.count=0 git.fetch.deepen=0 git.fetch.thin_pack=false git.fetch.ofs_delta=true git.protocol.version=2 git.pkt.frames=3 git.pkt.data=2 git.pkt.flush=1 git.pkt.delim=0 git.pkt.bytes=1317 git.pkt.payload.max=1296 git.sideband.band1.bytes=1295 git.sideband.band2.bytes=0 git.sideband.band3.bytes=0
Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.
- Remote
- https://5ad2236b39de4c8bd8f6270ea63f3ea9.artifacts.cloudflare.net/git/public-v0/curl.git
- Ref
- refs/heads/master
- Commit
- 31c911efe5652725e930f4d2e60c9060e5f6646d
- cf-ray
- a5e1db660964ecfa
- Request
- 87f128be…
- Protocol
- v2 · sha1
- Agent
- gitty/1.0
- Filter
- advertised
- Fetch
- shallow filter sideband-all
- Capabilities
- agent ls-refs fetch object-format