#!/bin/sh
set -eu

self=$0
while [ -L "$self" ]; do
  link=$(readlink "$self")
  case "$link" in
    /*) self=$link ;;
    *) self=$(dirname -- "$self")/$link ;;
  esac
done
script_dir=$(CDPATH= cd -- "$(dirname -- "$self")" && pwd)
command -v pwsh >/dev/null 2>&1 || {
  echo 'unpack-flow requires PowerShell 7 on macOS: brew install powershell' >&2
  exit 4
}
exec pwsh -NoLogo -NoProfile -File "$script_dir/unpack-flow.ps1" "$@"
