File: fakecmd.py

package info (click to toggle)
python-sphinxcontrib.plantuml 0.31-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 176 kB
  • sloc: python: 949; makefile: 141
file content (20 lines) | stat: -rwxr-xr-x 475 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env python
import sys


def dump(fout, fin):
    # embed as PostScript comment
    fout.write('% ' + ' '.join(sys.argv) + '\n')
    for line in fin:
        fout.write('% ' + line)


if '-pipe' in sys.argv:
    dump(sys.stdout, sys.stdin)
else:
    for fname in sys.argv[1:]:
        if not fname.endswith('.puml'):
            continue
        with open(fname[:-5] + '.png', 'w') as fout:
            with open(fname, 'r') as fin:
                dump(fout, fin)