diff --git a/rwm.py b/rwm.py index 84a4de5fb08ed0fdc5e45d5f5262d92411f24006..bba8b8a191c5c99b9a3336f6005c2f6829838b43 100755 --- a/rwm.py +++ b/rwm.py @@ -68,6 +68,35 @@ def size_fmt(num): return f'{num:0.1f} YiB' +class BackupConfig(BaseModel): + """Configuration for backup operations. + + Attributes: + filesdirs: + REQUIRED. List of files and directories to be backed up. + + excludes: + List of patterns for `--exclude` options for `restic backup` commmand. Defaults to an empty list. + + extras: + Additional options for the `restic backup` commmand. Defaults to an empty list. + + prerun: + List of shell commands to execute before backup. Defaults to an empty list. + + postrun: + List of shell commands to execute after backup. Defaults to an empty list. + """ + + model_config = ConfigDict(extra='forbid') + + filesdirs: List[str] + excludes: List[str] = [] + extras: List[str] = [] + prerun: List[str] = [] + postrun: List[str] = [] + + class RWMConfig(BaseModel): """Main configuration for RWM. Configuration file format is YAML. @@ -106,35 +135,6 @@ class RWMConfig(BaseModel): retention: Dict[str, str] = {} -class BackupConfig(BaseModel): - """Configuration for backup operations. - - Attributes: - filesdirs: - REQUIRED. List of files and directories to be backed up. - - excludes: - List of patterns for `--exclude` options for `restic backup` commmand. Defaults to an empty list. - - extras: - Additional options for the `restic backup` commmand. Defaults to an empty list. - - prerun: - List of shell commands to execute before backup. Defaults to an empty list. - - postrun: - List of shell commands to execute after backup. Defaults to an empty list. - """ - - model_config = ConfigDict(extra='forbid') - - filesdirs: List[str] - excludes: List[str] = [] - extras: List[str] = [] - prerun: List[str] = [] - postrun: List[str] = [] - - class RwmJSONEncoder(json.JSONEncoder): """json encoder"""