代码拉取完成,页面将自动刷新
#!/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)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。