From 3201f4b7d4d30153ac05e0728a2686619218e69c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jesu=CC=81s=20Pe=CC=81rez?= Date: Sun, 30 Nov 2025 10:09:29 +0000 Subject: [PATCH] fix: allow just complete-update to fallback to system Nushell binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When Nushell is already installed in the OS, complete-update should use the system binary instead of requiring a compiled binary first. This removes the circular dependency: BEFORE: complete-update required compiled nu binary - If nu not compiled: ❌ error - Force-compiles to 0.108.0 even if 0.109 update requested AFTER: complete-update now has smart fallback - Try compiled binary first (if exists) - Fall back to system nu (if available) - Only error if neither exists This makes the script work in real-world scenarios where users have Nushell installed in their OS. --- justfiles/version_update.just | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/justfiles/version_update.just b/justfiles/version_update.just index dc16866..4b13d80 100644 --- a/justfiles/version_update.just +++ b/justfiles/version_update.just @@ -16,12 +16,23 @@ complete-update VERSION="": exit 1 fi echo "🚀 Complete Nushell Update (ALL-IN-ONE) - RUNNER" - echo "Note: Using built nu 0.108.0 binary (system nu may be broken)" echo "" cd "{{justfile_directory()}}" SCRIPT_DIR="{{justfile_directory()}}/scripts" - # Use newly built nu binary instead of broken system nu - NU_BIN="{{justfile_directory()}}/nushell/target/release/nu" + + # Determine which nu binary to use (prefer compiled, fallback to system) + COMPILED_NU="{{justfile_directory()}}/nushell/target/release/nu" + if [ -f "$COMPILED_NU" ]; then + NU_BIN="$COMPILED_NU" + echo "Using compiled Nushell binary: $NU_BIN" + elif command -v nu &> /dev/null; then + NU_BIN="nu" + echo "Using system Nushell binary: $(which nu)" + else + echo "❌ Error: No Nushell binary found (neither compiled nor in system)" + echo "Please install Nushell or compile it first" + exit 1 + fi echo "Step 1/7: Downloading Nushell {{VERSION}}..." echo " 📝 Command: $NU_BIN $SCRIPT_DIR/download_nushell.nu {{VERSION}}" @@ -110,11 +121,23 @@ complete-update-interactive VERSION="": exit 1 fi echo "🚀 Complete Nushell Update (INTERACTIVE MODE)" - echo "Note: Using built nu binary (system nu may be broken)" echo "" cd "{{justfile_directory()}}" SCRIPT_DIR="{{justfile_directory()}}/scripts" - NU_BIN="{{justfile_directory()}}/nushell/target/release/nu" + + # Determine which nu binary to use (prefer compiled, fallback to system) + COMPILED_NU="{{justfile_directory()}}/nushell/target/release/nu" + if [ -f "$COMPILED_NU" ]; then + NU_BIN="$COMPILED_NU" + echo "Using compiled Nushell binary: $NU_BIN" + elif command -v nu &> /dev/null; then + NU_BIN="nu" + echo "Using system Nushell binary: $(which nu)" + else + echo "❌ Error: No Nushell binary found (neither compiled nor in system)" + echo "Please install Nushell or compile it first" + exit 1 + fi echo "Step 1/7: Downloading Nushell {{VERSION}}..." "$NU_BIN" "$SCRIPT_DIR/download_nushell.nu" "{{VERSION}}" || exit 1