提交 380068e6 作者: Juan Batiz-Benet

cmdrefgen to generate command ref

上级 01feeac1
#!/usr/bin/env python
import os
import sys
import datetime
import subprocess
from subprocess import check_output
def run(cmd):
return check_output(cmd)
def main():
lines = [l.strip() for l in sys.stdin]
print '# ipfs command reference'
print ''
print 'generated on', datetime.datetime.now()
print ''
for line in lines:
print '- [%s](#%s)' % (line, line.replace(' ', '-'))
print ''
for line in lines:
print '## %s' % line
print ''
print '```'
print run((line + ' --help').split(' ')).strip()
print '```'
print ''
if __name__ == '__main__':
if '-h' in sys.argv or '--help' in sys.argv:
print 'usage: ipfs commands | %s >cmdref.md' % sys.argv[0]
print 'outputs all commands with --help to a markdown file'
exit(0)
main()
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论