#!/usr/bin/env bash

# omarchy:summary=Stop a Linux-only installer on macOS with one line and exit 0
# omarchy:hidden=true

# Based: the first line of an installer whose whole row is Linux only:
#
#   source omarchy-require-linux
#
# Sourced on macOS it names the caller, says there is nothing to install and
# exits the caller with 0, so the menu's presentation wrapper reports no
# failure. On Linux it does nothing. Run as a command it cannot stop its
# caller, so it exits 1 on macOS instead, for `omarchy-require-linux || exit 0`.
if [[ $(omarchy-os) == darwin ]]; then
  if [[ ${BASH_SOURCE[0]} != "$0" ]]; then
    echo "$(basename "$0"): Linux only; nothing to install on macOS" >&2
    exit 0
  fi
  echo "omarchy-require-linux: Linux only; nothing to install on macOS" >&2
  exit 1
fi
