cds1011-ls2/arguments.py
2025-11-29 16:16:16 +01:00

53 lines
1.2 KiB
Python

from enum import Enum
class Mode(Enum):
V = "v"
A = "a"
C = "c"
class Information(Enum):
DISABLED = False
ENABLED = True
class Graph(Enum):
DISABLED = False
ENABLED = True
class Arguments:
def __init__(self, file_path):
self.file_path = file_path
self.mode = None
self.information = None
self.graph = None
def get_file_path(self):
return self.file_path
def get_mode(self):
return self.mode
def set_mode(self, value):
try:
self.mode = Mode(value)
except ValueError:
raise ValueError(f"Invalid mode '{value}'. Allowed values: {[m.value for m in Mode]}")
def get_information(self):
return self.information
def set_information(self, value):
try:
self.information = Information(value)
except ValueError:
raise ValueError(f"Invalid information '{value}'. Allowed values: {[m.value for m in Information]}")
def get_graph(self):
return self.graph
def set_graph(self, value):
try:
self.graph = Graph(value)
except ValueError:
raise ValueError(f"Invalid graph '{value}'. Allowed values: {[m.value for m in Graph]}")