-
-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathremove_toolchains.sh
More file actions
executable file
·66 lines (55 loc) · 2.13 KB
/
remove_toolchains.sh
File metadata and controls
executable file
·66 lines (55 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
# ⚠️ WARNING: DESTRUCTIVE TESTING UTILITY ⚠️
# This script REMOVES ALL Rust toolchains from your system!
#
# Purpose: Testing utility for cmdr's upgrade check feature (cmdr/src/analytics_client/upgrade_check.rs)
#
# Use Case: When developing/testing the upgrade progress display in cmdr apps (edi, giti),
# you need to see the full rustup installation progress. This script creates a clean slate
# by removing all toolchains, so when you run `cargo run --bin edi` or `cargo run --bin giti`,
# you'll see:
# - Full rustup download progress
# - Installation messages
# - Compilation progress percentages
#
# Usage:
# ./remove_toolchains.sh # Removes ALL toolchains
#
# Recovery after testing:
# rustup toolchain install stable
# rustup default stable
# # Or use: fish run.fish update-toolchain
#
# Note: This is a manual testing tool, not invoked by any code.
set -e # Exit on any error
echo "🔧 Removing all rustup toolchains for testing..."
# Save current directory and change to temp directory to avoid rust-toolchain.toml interference
TEMP_DIR=$(mktemp -d)
echo "📁 Working from temp directory: $TEMP_DIR"
pushd "$TEMP_DIR" > /dev/null
# List current toolchains for reference
echo "📋 Current toolchains:"
rustup toolchain list
echo ""
echo "🗑️ Removing ALL existing toolchains..."
# Remove all toolchains
for toolchain in $(rustup toolchain list | cut -d' ' -f1); do
echo " Removing: $toolchain"
rustup toolchain uninstall "$toolchain" || echo " ⚠️ Failed to remove $toolchain"
done
# Clean up any remaining toolchain directories
echo "🧹 Cleaning up toolchain directories..."
rm -rf "$HOME/.rustup/toolchains/"*
# Verify no toolchains remain
echo ""
echo "📋 Toolchains after cleanup:"
rustup toolchain list
echo ""
echo "✅ All toolchains removed!"
echo "🚀 Now when you run the upgrade process, it will show full progress"
echo "📝 The upgrade will install nightly with visible download/installation output"
echo "⚠️ Note: You'll need to set a default toolchain after upgrading"
echo ""
# Restore original directory and clean up temp directory
popd > /dev/null
rm -rf "$TEMP_DIR"