Skip to content

Commit

Permalink
Add cargo backup / reinstall (#291)
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-coutinho committed Dec 26, 2020
1 parent 61c6f82 commit b14140d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion shallow_backup/backup.py
Expand Up @@ -147,7 +147,7 @@ def run_cmd_if_no_dry_run(command, dest, dry_run) -> int:

# cargo
print_pkg_mgr_backup("cargo")
command = "ls {}".format(home_prefix(".cargo/bin/"))
command = r"cargo install --list | grep '^\w.*:$' | sed -E 's/ v(.*):$/ --version \1/'"
dest = f"{backup_path}/cargo_list.txt"
run_cmd_if_no_dry_run(command, dest, dry_run)

Expand Down
5 changes: 3 additions & 2 deletions shallow_backup/reinstall.py
Expand Up @@ -167,8 +167,9 @@ def run_cmd_if_no_dry_run(command, dry_run) -> int:
elif pm == "gem":
print_red_bold("WARNING: Gem reinstallation is not supported.")
elif pm == "cargo":
print_red_bold("WARNING: Cargo reinstallation is not possible at the moment.\
\n -> https://github.com/rust-lang/cargo/issues/5593")
print_pkg_mgr_reinstall(pm)
cmd = f"cat {packages_path}/cargo_list.txt | xargs -L 1 cargo install"
run_cmd_if_no_dry_run(cmd, dry_run)

print_section_header("PACKAGE REINSTALLATION COMPLETED", Fore.BLUE)

Expand Down

0 comments on commit b14140d

Please sign in to comment.