mirror of
https://gitlab.com/manzerbredes/esds.git
synced 2025-04-07 02:26:28 +02:00
Update main
This commit is contained in:
parent
57f00b0b39
commit
a83b267acd
1 changed files with 11 additions and 5 deletions
|
@ -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):
|
def run(arguments):
|
||||||
parser = argparse.ArgumentParser(description='Run a simulation')
|
parser = argparse.ArgumentParser(description='Run a simulation')
|
||||||
parser.add_argument("platform", help="Run a simulation using a specific platform file")
|
parser.add_argument("platform", help="Run a simulation using a specific platform file")
|
||||||
args = parser.parse_args(arguments[1:])
|
args = parser.parse_args(arguments[1:])
|
||||||
if args.platform:
|
if args.platform:
|
||||||
print("Run simulation using "+args.platform)
|
simulation=YAMLPlatformFile(args.platform)
|
||||||
|
simulation.run()
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
||||||
|
@ -13,11 +18,12 @@ def main():
|
||||||
##### Parse arguments
|
##### Parse arguments
|
||||||
parser = argparse.ArgumentParser(
|
parser = argparse.ArgumentParser(
|
||||||
description='ESDS Simulator CLI toolbox. Allow you to run simulations and perform various tasks.')
|
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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
##### Run commands
|
##### Run commands
|
||||||
if args.run:
|
if args.command:
|
||||||
run(args.run)
|
if args.command[0] == "run":
|
||||||
|
run(args.command)
|
||||||
else:
|
else:
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
|
|
Loading…
Add table
Reference in a new issue