From a83b267acd8c383a1f9f695df486bce1185a00f6 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Sun, 11 Sep 2022 18:25:11 +0200 Subject: [PATCH] Update main --- esds/__main__.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/esds/__main__.py b/esds/__main__.py index 8797f2d..5e818de 100644 --- a/esds/__main__.py +++ b/esds/__main__.py @@ -1,11 +1,16 @@ -import sys, argparse +import sys, argparse, os +from esds.helpers.platform import YAMLPlatformFile + +# Allow importlib to import file from current working directory +sys.path.insert(0, os.getcwd()) def run(arguments): parser = argparse.ArgumentParser(description='Run a simulation') parser.add_argument("platform", help="Run a simulation using a specific platform file") args = parser.parse_args(arguments[1:]) if args.platform: - print("Run simulation using "+args.platform) + simulation=YAMLPlatformFile(args.platform) + simulation.run() else: parser.print_help() @@ -13,11 +18,12 @@ def main(): ##### Parse arguments parser = argparse.ArgumentParser( description='ESDS Simulator CLI toolbox. Allow you to run simulations and perform various tasks.') - parser.add_argument("run", help="Run a simulation", nargs=argparse.REMAINDER) + parser.add_argument("command", help="Execute the specified command", nargs=argparse.REMAINDER) args = parser.parse_args() ##### Run commands - if args.run: - run(args.run) + if args.command: + if args.command[0] == "run": + run(args.command) else: parser.print_help()