3 from .builders import builders
4 from .document import WLDocument
7 def main(*args, **kwargs):
8 parser = argparse.ArgumentParser(description="PARSER DESCRIPTION")
12 choices=[b.identifier for b in builders],
15 parser.add_argument('input_file')
17 '-o', '--output-file', metavar='FILE',
18 help='specifies the output file'
21 '-O', '--output-dir', metavar='DIR',
22 help='specifies the directory for output'
25 args = parser.parse_args()
28 output_file_path = args.output_file
30 output_file_path = '.'.join((
31 os.path.splitext(args.input_file)[0],
32 builder.file_extension
35 output_file_path = '/'.join((
37 output_file_path.rsplit('/', 1)[-1]
40 document = WLDocument(filename=args.input_file)
41 output = document.build(args.builder)
42 with open(output_file_path, 'wb') as f:
43 f.write(output.get_bytes())