regen-readme.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 
3 import subprocess
4 import os
5 import sys
6 
7 basedir = os.path.dirname(sys.argv[0])
8 readme = os.path.join(basedir, "doc/using.md")
9 
10 with open(readme) as f:
11  inp = f.read()
12 
13 out = ""
14 
15 it = iter(inp.splitlines(True))
16 
17 for line in it:
18  out += line
19  if line.startswith("```cmdoutput"):
20  # Get command.
21  cmd = next(it)
22  assert cmd.startswith("$ "), cmd
23  real_cmd = cmd[2:].strip()
24  out += cmd
25 
26  print("Running: " + real_cmd)
27  out += subprocess.check_output(real_cmd, shell=True)
28 
29  # Skip pre-existing command output.
30  line = next(it)
31  while not line.startswith("```"):
32  line = next(it)
33  out += line
34 
35 with open(readme, "w") as f:
36  f.write(out)
next
AllocList * next[kMaxLevel]
Definition: abseil-cpp/absl/base/internal/low_level_alloc.cc:100
open
#define open
Definition: test-fs.c:46
iter
Definition: test_winkernel.cpp:47


grpc
Author(s):
autogenerated on Fri May 16 2025 03:00:01