blob: ccbad20ddd5add4e90b8b69599716bf1303c57ac (
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
30
31
|
import sys, argparse, os
from .platform import YAMLPlatformFile
from esds import __version__
def run(platform):
simulation=YAMLPlatformFile(platform)
# Allow importlib (in simulator.run()) to import file from the platform.yaml directory
sys.path.insert(0, simulation.location)
simulation.run()
def main():
##### Main parser
parser = argparse.ArgumentParser(
description='ESDS simulator command line interface. Run simulations and perform various simulation tasks.',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("--version", help="Show esds version", action="store_true")
subparsers = parser.add_subparsers(dest="command", help='Execute the specified command')
##### Run subparser
run_parser=subparsers.add_parser("run", description='Run a simulation')
run_parser=run_parser.add_argument("platform", help="Platform file")
##### Execute commands
args = parser.parse_args()
if args.command:
if args.command == "run":
run(args.platform)
elif args.version:
print("ESDS v"+__version__)
else:
parser.print_help()
|