#!/bin/bash
# Bash wrapper for syntaxis installation script
# Sets up NU_LIB_DIRS environment so NuShell can import modules

set -e

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"

# Export NU_LIB_DIRS so nu scripts can use 'source xxx' imports
# Include: scripts dir, .cargo/bin, and config scripts dir
export NU_LIB_DIRS="$SCRIPT_DIR:$HOME/.config/syntaxis/scripts"

# Change to project root so Cargo.toml and configs are accessible
cd "$PROJECT_ROOT"

# Execute the NuShell installation script with all arguments
# Pass the script directory as a parameter for library path
nu "$SCRIPT_DIR/install-syntaxis.nu" "$@"
