nix-update/nix_update/options.py

33 lines
937 B
Python
Raw Normal View History

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
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
version: str = "stable"
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
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
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:
self.escaped_attribute = ".".join(map(json.dumps, self.attribute.split(".")))
self.escaped_import_path = json.dumps(self.import_path)