From 43703505eaaf3974b4e35bdac34b9185c12b3c13 Mon Sep 17 00:00:00 2001 From: eric Date: Sat, 13 Apr 2024 01:13:24 -0400 Subject: [PATCH] version 0.8.8 fixes and improvements for --file mode --- baka.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/baka.py b/baka.py index 658fc1c..4bcbc8f 100755 --- a/baka.py +++ b/baka.py @@ -31,7 +31,7 @@ import time import typing -__version__: typing.Final[str] = "0.8.7" +__version__: typing.Final[str] = "0.8.8" BASE_PATH: typing.Final[str] = os.path.expanduser("~/.baka") @@ -458,7 +458,7 @@ def main() -> int: current_os = "windows" if os.name == "nt" else "linux" not_current_os_abbrev = "l" if current_os == "windows" else "w" copy_command = ["cp", "-f"] if current_os == "linux" else ["copy", "/Y"] - os.path.makedirs(os.path.join(BASE_PATH, config.hostname), exist_ok=True) + os.makedirs(os.path.join(BASE_PATH, config.hostname), exist_ok=True) for file in file_list: assert len(config.files[file]) == 1 file_key = list(config.files[file].keys())[0] @@ -466,12 +466,12 @@ def main() -> int: continue if args.file[0] in ["save", "s"]: if "src" in file_key.split("_"): - cmds.append([*copy_command, config.files[file][file_key], os.path.join(BASE_PATH, config.hostname, file)]) - elif "cmd" in config.files[file]: - cmds.append(["BAKA_DEST", os.path.join(BASE_PATH, config.hostname, file), *config.files[file]["cmd"]]) + cmds.append([*copy_command, os.path.expandvars(os.path.expanduser(config.files[file][file_key])), os.path.join(BASE_PATH, config.hostname, file)]) + elif "cmd" in file_key.split("_"): + cmds.append(["BAKA_DEST", os.path.join(BASE_PATH, config.hostname, file), *config.files[file][file_key]]) elif args.file[0] in ["restore", "r"]: if "src" in file_key.split("_"): - cmds.append([*copy_command, os.path.join(BASE_PATH, config.hostname, file), config.files[file][file_key]]) + cmds.append([*copy_command, os.path.join(BASE_PATH, config.hostname, file), os.path.expandvars(os.path.expanduser(config.files[file][file_key]))]) cmds.append(["git", "add", "--ignore-errors", "--all"]) cmds.append(["git", "commit", "-m", f"baka file {config.hostname}"]) elif args.job: