From ca4f345b7ed245c4c027b188bdfd5e99106b5431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferit=20Yi=C4=9Fit=20BALABAN?= Date: Sat, 11 Feb 2023 00:52:41 +0300 Subject: [PATCH] ! implement func. interactive prints message deploy() --- dotman.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dotman.py b/dotman.py index 3cd0f73..a39185b 100755 --- a/dotman.py +++ b/dotman.py @@ -192,7 +192,7 @@ def backup(): # exec git commit -m "[message]" && git push -def deploy(): +def deploy(interactive=False): """ Kindly executes the steps to get a up-to-date local repository, deploy (copy) files and directories to the local config directory. @@ -200,12 +200,16 @@ def deploy(): if not os.path.exists(SETTINGS.DIR_REPO): r = SETTINGS.DIR_REPO r.removesuffix("/")[:r.removesuffix("/").rindex("/")] + if interactive: + print(f"Local repository at {SETTINGS['DIR_REPO']} wasn't found. Cloning at {r}") run(shlex.split(f"/usr/bin/git clone {SETTINGS[URL_REPO]}"), text=True, cwd=r) + if interactive: + print("Pulling changes") run(shlex.split("/usr/bin/git pull"), text=True, cwd=r) for file in DL_FILES: - copy(files) + copy(files, interactive=interactive) for directory in DL_DIRS: - copy(directory) + copy(directory, interactive=interactive) def expand_settings():