#!/bin/sh set -e # Sequel CLI installer REPO="sequelsh/sequel" BIN_NAME="sequel" # ── Detect platform ─────────────────────────────────────────────────────────── OS="$(uname -s)" ARCH="$(uname -m)" case "$OS" in Darwin) OS="darwin" ;; Linux) OS="linux" ;; *) echo "Unsupported OS: $OS" >&2; exit 1 ;; esac case "$ARCH" in arm64|aarch64) ARCH="arm64" ;; x86_64|amd64) ARCH="x64" ;; *) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;; esac ASSET="${BIN_NAME}-${OS}-${ARCH}" URL="https://github.com/${REPO}/releases/latest/download/${ASSET}" echo "Downloading Sequel CLI ($OS/$ARCH)…" TMP="$(mktemp)" if ! curl -fsSL "$URL" -o "$TMP"; then echo "Failed to download $URL" >&2 exit 1 fi chmod +x "$TMP" # ── Choose an install location ──────────────────────────────────────────────── if [ -w /usr/local/bin ] 2>/dev/null; then DEST="/usr/local/bin/${BIN_NAME}" mv "$TMP" "$DEST" elif command -v sudo >/dev/null 2>&1 && [ -d /usr/local/bin ]; then DEST="/usr/local/bin/${BIN_NAME}" sudo mv "$TMP" "$DEST" else mkdir -p "$HOME/.sequel/bin" DEST="$HOME/.sequel/bin/${BIN_NAME}" mv "$TMP" "$DEST" case ":$PATH:" in *":$HOME/.sequel/bin:"*) ;; *) echo ""; echo "Add this to your shell profile:"; echo " export PATH=\"\$HOME/.sequel/bin:\$PATH\"" ;; esac fi echo "" echo "Installed Sequel CLI to $DEST" echo "Run 'sequel login' to get started."