#!/bin/bash

# Detect the platform
PLATFORM="$(uname -s)"
ARCH="$(uname -m)"

# Determine which binary to use
if [ "$PLATFORM" = "Darwin" ]; then
    if [ "$ARCH" = "arm64" ]; then
        BINARY="obsidian-export-aarch64-apple-darwin"
    else
        echo "Unsupported architecture on macOS: $ARCH"
        exit 1
    fi
elif [ "$PLATFORM" = "Linux" ]; then
    if [ "$ARCH" = "x86_64" ]; then
        BINARY="obsidian-export-x86_64_unknown-linux-gnu"
    else
        echo "Unsupported architecture on Linux: $ARCH"
        exit 1
    fi
else
    echo "Unsupported platform: $PLATFORM"
    exit 1
fi

# Make sure the binary is executable
chmod +x "$BINARY"

# Run the appropriate binary
./"$BINARY" --start-at content-sources/obsidian-default/Blog content-sources/obsidian-default/ content/blog/