(Added) sync one function.

Added Rsync wrappper.
Added fzf_prompt, all_labels for choosing a label of source.
This commit is contained in:
2023-02-27 16:21:10 +02:00
parent b9d8131c3b
commit 467989bbd5
9 changed files with 126 additions and 4 deletions
+18 -3
View File
@@ -29,7 +29,7 @@ class Path(BaseModel):
path = CharField(unique=True)
def __str__(self) -> str:
return f"Path({self.path})"
return f"{self.path}"
def __repr__(self) -> str:
return f"Path({self.path})"
@@ -37,6 +37,9 @@ class Path(BaseModel):
class SyncCommand(BaseModel):
command = CharField()
def __str__(self) -> str:
return self.command
class Source(BaseModel):
label = CharField(unique=True)
source = ForeignKeyField(Path)
@@ -58,10 +61,22 @@ class Source(BaseModel):
src.save()
return src
def __str__(self) -> str:
return f"{self.label}"
def __repr__(self) -> str:
return f"{self.label}"
class Destination(BaseModel):
source = ForeignKeyField(Source, backref='destinations')
path = ForeignKeyField(Path)
def __str__(self) -> str:
return f"{self.path}"
def create_tables():
db.connect()
db.create_tables([Source, Path, Destination, SyncCommand], safe=True)
with db:
db.create_tables([Source, Path, Destination, SyncCommand], safe=True)
def all_labels():
with db:
return Source.select(Source.label)