Start of simulation application

This commit is contained in:
2026-07-31 11:46:06 +02:00
parent b3aabae5e8
commit 66737e323b
8 changed files with 360 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
from __future__ import annotations
import sys
import argparse
def parse_arguments():
parser = argparse.ArgumentParser(exit_on_error=False)
parser.add_argument(
"-f", "--file", type=str, help="Path to a BEditor BEsim file to open", default=None, required=False
)
parser.add_argument(
"-c", "--component", type=str, help="Component path in BEdit file to simulate", default=None, required=False
)
parser.add_argument(
"-s", "--simulation", type=str, help="Simulation name in BEdit file to simulate", default=None, required=False
)
return parser.parse_args(), parser
def main() -> int:
try:
args, parser = parse_arguments()
# TODO check if file is a BEditor file (.beb or .json)
if args.file and not (args.component or args.simulation):
parser.error("Component or Simulation required when opening a BEdit file")
except argparse.ArgumentError as e:
print(e.message)
return 1
return 0