From 1be34f6031f411b2b99d97c88b5ffb580a800743 Mon Sep 17 00:00:00 2001 From: Thibaud Date: Fri, 14 Dec 2018 18:12:44 +0100 Subject: [PATCH] Add cmdline argument parser --- configurator/configurator.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/configurator/configurator.py b/configurator/configurator.py index a274137..6dfefbd 100644 --- a/configurator/configurator.py +++ b/configurator/configurator.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import argparse import os import shutil import subprocess @@ -143,9 +144,19 @@ def dict_to_list(d): return [item for k in d for item in (k, d[k])] +def main(): + parser = argparse.ArgumentParser() + parser.add_argument('osmfile', type=str) + parser.add_argument('--path', type=str, help='Where to generate the files') + parser.add_argument('--name', type=str, required=True, help='Name of the scenario to generate') + args = parser.parse_args() + generate_all(args.osmfile, args.path, args.name) + + if __name__ == '__main__': if os.path.isdir('/tmp/scenario/foo'): shutil.rmtree('/tmp/scenario/foo') path = '/tmp/scenario/' osm = '/tmp/scenario/map.osm' generate_all(osm, path, 'foo') + # main()