diff --git a/shallow_backup/backup.py b/shallow_backup/backup.py index 5b0f8792..1db8739c 100644 --- a/shallow_backup/backup.py +++ b/shallow_backup/backup.py @@ -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) diff --git a/shallow_backup/reinstall.py b/shallow_backup/reinstall.py index b52d2be6..c35fe3a6 100644 --- a/shallow_backup/reinstall.py +++ b/shallow_backup/reinstall.py @@ -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)