Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cargo backup / reinstall #291

Merged
merged 1 commit into from
Dec 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion shallow_backup/backup.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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