Add fancy CLI options

This commit is contained in:
Joscha
2021-05-15 21:33:51 +02:00
parent c454fabc9d
commit 05573ccc53
4 changed files with 250 additions and 56 deletions

View File

@ -32,6 +32,14 @@ class Redownload(Enum):
ALWAYS = "always"
ALWAYS_SMART = "always-smart"
@staticmethod
def from_string(string: str) -> "Redownload":
try:
return Redownload(string)
except ValueError:
raise ValueError("must be one of 'never', 'never-smart',"
" 'always', 'always-smart'")
class OnConflict(Enum):
PROMPT = "prompt"
@ -39,6 +47,14 @@ class OnConflict(Enum):
REMOTE_FIRST = "remote-first"
NO_DELETE = "no-delete"
@staticmethod
def from_string(string: str) -> "OnConflict":
try:
return OnConflict(string)
except ValueError:
raise ValueError("must be one of 'prompt', 'local-first',"
" 'remote-first', 'no-delete'")
@dataclass
class Heuristics: