2023-08-02 01:59:14 +03:00
|
|
|
import json
|
2022-12-08 20:11:00 +03:00
|
|
|
import os
|
2023-01-05 03:55:31 +03:00
|
|
|
from dataclasses import dataclass, field
|
2022-11-15 01:13:11 +03:00
|
|
|
|
2021-08-26 16:00:20 +03:00
|
|
|
from .version.version import VersionPreference
|
2020-03-17 16:22:33 +03:00
|
|
|
|
2020-03-22 19:38:08 +03:00
|
|
|
|
2020-03-17 16:22:33 +03:00
|
|
|
@dataclass
|
|
|
|
class Options:
|
|
|
|
attribute: str
|
2022-12-08 20:11:00 +03:00
|
|
|
flake: bool = False
|
2021-01-25 02:30:37 +03:00
|
|
|
version: str = "stable"
|
2021-08-26 16:00:20 +03:00
|
|
|
version_preference: VersionPreference = VersionPreference.STABLE
|
2021-01-09 10:55:05 +03:00
|
|
|
version_regex: str = "(.*)"
|
2022-12-08 20:11:00 +03:00
|
|
|
import_path: str = os.getcwd()
|
2023-08-25 09:53:31 +03:00
|
|
|
override_filename: str | None = None
|
|
|
|
url: str | None = None
|
2021-01-09 10:55:05 +03:00
|
|
|
commit: bool = False
|
2022-11-28 18:43:41 +03:00
|
|
|
use_update_script: bool = False
|
2023-08-25 09:53:31 +03:00
|
|
|
write_commit_message: str | None = None
|
2021-01-09 10:55:05 +03:00
|
|
|
shell: bool = False
|
|
|
|
run: bool = False
|
|
|
|
build: bool = False
|
|
|
|
test: bool = False
|
2021-01-28 17:40:19 +03:00
|
|
|
review: bool = False
|
2021-02-21 19:41:33 +03:00
|
|
|
format: bool = False
|
2023-08-25 09:53:31 +03:00
|
|
|
system: str | None = None
|
|
|
|
extra_flags: list[str] = field(default_factory=list)
|
2023-08-02 01:59:14 +03:00
|
|
|
|
|
|
|
def __post_init__(self) -> None:
|
2023-08-06 21:17:25 +03:00
|
|
|
self.escaped_attribute = ".".join(map(json.dumps, self.attribute.split(".")))
|
2023-08-23 18:10:20 +03:00
|
|
|
self.escaped_import_path = json.dumps(self.import_path)
|