#!/usr/bin/env sh
#
# ---
# source: https://github.com/dandavison/rgi/blob/main/src/rgi/scripts/rgi-preview

file="$1"
line="$2"

start_line=$((line - 10))
start_line=$((start_line < 1 ? 1 : start_line))

bat --color=always \
  --style=header,grid \
  --terminal-width=999 \
  -H "${line}" \
  -r "${start_line}":+70 \
  "${file}"
