1 Star 0 Fork 0

boilingolf/bloaty

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
regen-readme.py 698 Bytes
一键复制 编辑 原始数据 按行查看 历史
Josh Haberman 提交于 2021-08-04 15:12 . Split and updated the docs.
#!/usr/bin/env python
import subprocess
import os
import sys
basedir = os.path.dirname(sys.argv[0])
readme = os.path.join(basedir, "doc/using.md")
with open(readme) as f:
inp = f.read()
out = ""
it = iter(inp.splitlines(True))
for line in it:
out += line
if line.startswith("```cmdoutput"):
# Get command.
cmd = next(it)
assert cmd.startswith("$ "), cmd
real_cmd = cmd[2:].strip()
out += cmd
print("Running: " + real_cmd)
out += subprocess.check_output(real_cmd, shell=True)
# Skip pre-existing command output.
line = next(it)
while not line.startswith("```"):
line = next(it)
out += line
with open(readme, "w") as f:
f.write(out)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/boilingolf/bloaty.git
[email protected]:boilingolf/bloaty.git
boilingolf
bloaty
bloaty
master

搜索帮助