summaryrefslogtreecommitdiff
path: root/esds/__main__.py
blob: 5e818de8a4034d1332fb6f15223aae12bd838e62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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:
        simulation=YAMLPlatformFile(args.platform)
        simulation.run()
    else:
        parser.print_help()

def main():
    ##### Parse arguments
    parser = argparse.ArgumentParser(
        description='ESDS Simulator CLI toolbox. Allow you to run simulations and perform various tasks.')
    parser.add_argument("command", help="Execute the specified command", nargs=argparse.REMAINDER)
    args = parser.parse_args()

    ##### Run commands
    if args.command:
        if args.command[0] == "run":
            run(args.command)
    else:
        parser.print_help()