blob: bf05b24b0b13f8478f07c1383a12e79897e65e2d (
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
32
33
|
import sys, argparse, os
import platform
# 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 command line interface. Run simulations and perform various simulation tasks.',
formatter_class=argparse.RawTextHelpFormatter)
parser.add_argument("command", help="Execute the specified command.\nAvailable commands are: run", nargs=argparse.REMAINDER)
parser.add_argument("--version", help="Show esds version", action="store_true")
args = parser.parse_args()
##### Run commands
if args.command:
if args.command[0] == "run":
run(args.command)
elif args.version:
print("ESDS v"+__version__)
else:
parser.print_help()
|