runners : Create runners file and basic runnners
This adds runners.py, it contains a set of functions that peform all the various task that unisync can do (sync, add and mount for now). They are simple function that put together all the rest.
This commit is contained in:
32
src/unisync/runners.py
Normal file
32
src/unisync/runners.py
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
from synchroniser import Synchroniser
|
||||||
|
from paths import PathsManager
|
||||||
|
|
||||||
|
|
||||||
|
def unisync_sync(synchroniser:Synchroniser, paths_manager:PathsManager):
|
||||||
|
if synchroniser.create_ssh_master_connection() != 0:
|
||||||
|
print("Connection failed quitting")
|
||||||
|
return 1
|
||||||
|
print("Connected to the remote.")
|
||||||
|
|
||||||
|
synchroniser.sync_files(paths_manager.get_paths_to_sync())
|
||||||
|
synchroniser.update_links(background=False)
|
||||||
|
|
||||||
|
# TODO check the config options
|
||||||
|
#synchroniser.mount_remote_dir()
|
||||||
|
|
||||||
|
synchroniser.close_ssh_master_connection()
|
||||||
|
|
||||||
|
|
||||||
|
def unisync_add(synchroniser:Synchroniser, paths_manager:PathsManager):
|
||||||
|
if synchroniser.create_ssh_master_connection() != 0:
|
||||||
|
print("Connection failed quitting")
|
||||||
|
return 1
|
||||||
|
print("Connected to the remote.")
|
||||||
|
|
||||||
|
paths_manager.add_files_to_sync()
|
||||||
|
|
||||||
|
synchroniser.close_ssh_master_connection()
|
||||||
|
|
||||||
|
|
||||||
|
def unisync_mount(synchroniser:Synchroniser, paths_manager:PathsManager):
|
||||||
|
synchroniser.mount_remote_dir()
|
||||||
Reference in New Issue
Block a user