Skip to content

Commit

Permalink
version 0.8.8
Browse files Browse the repository at this point in the history
fixes and improvements for --file mode
  • Loading branch information
elesiuta committed Apr 13, 2024
1 parent ab2702a commit 4370350
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions baka.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")


Expand Down Expand Up @@ -458,20 +458,20 @@ 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]
if not_current_os_abbrev in file_key.split("_"):
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:
Expand Down

0 comments on commit 4370350

Please sign in to comment.