def command_line(): import argparse from parser import DatcomParser argparser = argparse.ArgumentParser() argparser.add_argument("datcom_file", help="the output file from datcom to parse") argparser.add_argument("-t", "--template", help="use a jinja2 template for generation" "(e.g. modelica.mo)") argparser.add_argument("-o", "--out", help="name of file generated from template") args = argparser.parse_args() parser = DatcomParser(args.datcom_file) if args.template: exporter = DatcomExporter(parser_dict=parser.get_common(), template_file=args.template) result = exporter.get_export() if args.out: with open(args.out, 'w') as f: f.write(result) else: print result else: for case in parser.get_cases(): print 'case: %s\n%s\n' % \ (case['ID'], case.keys())
def command_line(): import argparse from parser import DatcomParser argparser = argparse.ArgumentParser() argparser.add_argument("datcom_file", help="the output file from datcom to parse") argparser.add_argument("-t", "--template", help="use a jinja2 template for generation" "(e.g. modelica.mo)") argparser.add_argument("-o", "--out", help="name of file generated from template") args = argparser.parse_args() parser = DatcomParser(args.datcom_file) if args.template: exporter = DatcomExporter( parser_dict=parser.get_common(), template_file=args.template) result = exporter.get_export() if args.out: with open(args.out, 'w') as f: f.write(result) else: print result else: for case in parser.get_cases(): print 'case: %s\n%s\n' % \ (case['ID'], case.keys())
def command_line(): import argparse from parser import DatcomParser argparser = argparse.ArgumentParser() argparser.add_argument("datcom_file", help="the output file from datcom to parse") args = argparser.parse_args() parser = DatcomParser(args.datcom_file) plotter = DatcomPlotter(parser.get_common()) plotter.common_plots()