fix: allow just complete-update to fallback to system Nushell binary

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.
This commit is contained in:
Jesús Pérez 2025-11-30 10:09:29 +00:00
parent 8ffe992a26
commit 3201f4b7d4

View File

@ -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