mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-12 17:57:43 +00:00
(Added) sync one function.
Added Rsync wrappper. Added fzf_prompt, all_labels for choosing a label of source.
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user