Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions template/prepare.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/bin/bash

# Function to check if a command exists
command_exists () {
command -v "$1" >/dev/null 2>&1
}

missing_deps=0

# Check for Cargo
if ! (command_exists cargo); then
missing_deps=1
echo "❌ Cargo/rust is not installed."
echo ""
echo "To install Rust, visit the official download page:"
echo "👉 https://www.rust-lang.org/tools/install"
echo ""
echo "Or install it using a package manager:"
echo ""
echo "🔹 macOS (Homebrew):"
echo " brew install cargo"
echo ""
echo "🔹 Ubuntu/Debian:"
echo " sudo apt-get install -y cargo"
echo ""
echo "🔹 Arch Linux:"
echo " sudo pacman -S rust"
echo ""
fi

# Exit with a bad exit code if any dependencies are missing
if [ "$missing_deps" -ne 0 ]; then
echo "Install the missing dependencies and ensure they are on your path. Then run this command again."
# TODO: remove sleep when cli bug is fixed
sleep 2
exit 1
fi



2 changes: 1 addition & 1 deletion template/xtp.toml.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ build = "cargo build --release --target wasm32-wasi"
format = "cargo fmt"

# xtp plugin init runs this script before running the format script
# prepare = ""
prepare = "bash prepare.sh"
Loading