mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-08-20 05:37:43 +00:00
(Added) the dry-run flag to the sync one function.
This commit is contained in:
@@ -21,3 +21,6 @@
|
|||||||
Added *sync group* function.
|
Added *sync group* function.
|
||||||
** 0.6.0 <2023-03-09 Thu>
|
** 0.6.0 <2023-03-09 Thu>
|
||||||
Added *path checking* function.
|
Added *path checking* function.
|
||||||
|
** 0.6.1 <2023-03-12 Sun>
|
||||||
|
Added the *dry-run* flag to the *sync one* function.
|
||||||
|
|
||||||
|
|||||||
@@ -29,3 +29,8 @@ class Rsync:
|
|||||||
output = Popen(args, stdout=PIPE)
|
output = Popen(args, stdout=PIPE)
|
||||||
response = output.communicate()
|
response = output.communicate()
|
||||||
|
|
||||||
|
def dry_one(self, source, destination):
|
||||||
|
args = self.__args + ['--dry-run', source, destination]
|
||||||
|
output = Popen(args, stdout=PIPE)
|
||||||
|
response = output.communicate()
|
||||||
|
return response
|
||||||
|
|||||||
+13
-1
@@ -41,6 +41,10 @@ def one(
|
|||||||
help="[b]The label[/] is a uniq identification of a [b]source[/].",
|
help="[b]The label[/] is a uniq identification of a [b]source[/].",
|
||||||
show_default=False
|
show_default=False
|
||||||
),
|
),
|
||||||
|
dry: bool = typer.Option(
|
||||||
|
False, "-d", "--dry-run",
|
||||||
|
help="The command will [b]show[/] information about what will be changed.",
|
||||||
|
)
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
[green b]Sync[/] a [yellow]source[/] with the [yellow b]label[/] and its backups.
|
[green b]Sync[/] a [yellow]source[/] with the [yellow b]label[/] and its backups.
|
||||||
@@ -54,7 +58,12 @@ def one(
|
|||||||
if not dest.path.is_exists():
|
if not dest.path.is_exists():
|
||||||
console.print(skip_error)
|
console.print(skip_error)
|
||||||
continue
|
continue
|
||||||
rsync.run_one(str(src.source), str(dest))
|
if dry:
|
||||||
|
response = rsync.dry_one(str(src.source), str(dest))
|
||||||
|
out, err = response
|
||||||
|
console.print(f"{bstr_nonan(out)} {bstr_nonan(err)}")
|
||||||
|
else:
|
||||||
|
rsync.run_one(str(src.source), str(dest))
|
||||||
|
|
||||||
@sync.command()
|
@sync.command()
|
||||||
def group(
|
def group(
|
||||||
@@ -100,3 +109,6 @@ def recover(
|
|||||||
|
|
||||||
rsync = Rsync(str(src.args))
|
rsync = Rsync(str(src.args))
|
||||||
rsync.run_one(str(dest), str(src.source))
|
rsync.run_one(str(dest), str(src.source))
|
||||||
|
|
||||||
|
def bstr_nonan(obj):
|
||||||
|
return "" if obj is None else obj.decode()
|
||||||
|
|||||||
Reference in New Issue
Block a user