1
0
mirror of https://github.com/Ahp06/SUMO_Emissions.git synced 2024-11-24 12:36:30 +00:00

Add cmdline argument parser

This commit is contained in:
Thibaud Gasser 2018-12-14 18:12:44 +01:00
parent 801d090305
commit 1be34f6031

View File

@ -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()