diff options
| author | Loic Guegan <manzerbredes@mailbox.org> | 2022-09-11 18:25:11 +0200 |
|---|---|---|
| committer | Loic Guegan <manzerbredes@mailbox.org> | 2022-09-11 18:25:11 +0200 |
| commit | a83b267acd8c383a1f9f695df486bce1185a00f6 (patch) | |
| tree | a9144132c3735310c57e3d8a279afdbf7f41c8cb | |
| parent | 57f00b0b39fb6eeaf0d6593ca5d0a844fd30f620 (diff) | |
Update main
| -rw-r--r-- | esds/__main__.py | 16 |
1 files 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() |
