20 lines
559 B
Python
20 lines
559 B
Python
|
from argparse import ArgumentParser
|
||
|
|
||
|
from chordpro.base import Song
|
||
|
from chordpro.render.html import render
|
||
|
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
parser = ArgumentParser()
|
||
|
parser.add_argument('input', metavar='FILENAME', help='Input ChordPro file')
|
||
|
parser.add_argument('-o', '--output', metavar='FILENAME', help='Output to a file')
|
||
|
args = parser.parse_args()
|
||
|
|
||
|
song = Song(args.input)
|
||
|
output = render(song)
|
||
|
if args.output:
|
||
|
with open(args.output, 'w') as html_file:
|
||
|
html_file.write(output)
|
||
|
else:
|
||
|
print(output)
|