diff --git a/src/unisync/runners.py b/src/unisync/runners.py new file mode 100644 index 0000000..fe185f0 --- /dev/null +++ b/src/unisync/runners.py @@ -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()