Adds comments to the dataclasses in config
This commit is contained in:
@@ -8,6 +8,9 @@ import configparser
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ServerConfig:
|
class ServerConfig:
|
||||||
|
"""
|
||||||
|
Dataclass keeping the config for connecting to the server
|
||||||
|
"""
|
||||||
user: str
|
user: str
|
||||||
sshargs: list[str] | None = field(default_factory=list)
|
sshargs: list[str] | None = field(default_factory=list)
|
||||||
hostname: str = ""
|
hostname: str = ""
|
||||||
@@ -15,6 +18,9 @@ class ServerConfig:
|
|||||||
port: int = 22
|
port: int = 22
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
|
"""
|
||||||
|
Make sure a remote is provided and the ip address is valid
|
||||||
|
"""
|
||||||
if self.ip == "" and self.hostname == "":
|
if self.ip == "" and self.hostname == "":
|
||||||
raise ValueError("A remote must be provided (ip or hostname)")
|
raise ValueError("A remote must be provided (ip or hostname)")
|
||||||
|
|
||||||
@@ -26,16 +32,25 @@ class ServerConfig:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class RootsConfig:
|
class RootsConfig:
|
||||||
|
"""
|
||||||
|
Dataclass keeping the paths to the roots to synchronise
|
||||||
|
"""
|
||||||
local: str
|
local: str
|
||||||
remote: str
|
remote: str
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class UnisonConfig:
|
class UnisonConfig:
|
||||||
|
"""
|
||||||
|
Dataclass keeping unison specific configurations
|
||||||
|
"""
|
||||||
bools: list = field(default_factory=list)
|
bools: list = field(default_factory=list)
|
||||||
values: dict = field(default_factory=dict)
|
values: dict = field(default_factory=dict)
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class Config:
|
class Config:
|
||||||
|
"""
|
||||||
|
Main dataclass for the configurations
|
||||||
|
"""
|
||||||
server: ServerConfig
|
server: ServerConfig
|
||||||
roots: RootsConfig
|
roots: RootsConfig
|
||||||
unison: UnisonConfig
|
unison: UnisonConfig
|
||||||
|
|||||||
Reference in New Issue
Block a user