#!/usr/bin/env bash
set -euo pipefail

# Script Name: pix
# Description: View images in terminal with mpv
# Source: https://evanhahn.com/scripts-i-wrote-that-i-use-all-the-time/
# Usage: pix image.jpg
#        pix *.png
#        pix ~/Pictures/

if ! command -v mpv &>/dev/null; then
  echo "Error: mpv not found. Install with: sudo apt install mpv" >&2
  exit 1
fi

exec mpv \
  --image-display-duration=inf \
  --loop-file=inf \
  "$@"
