#!/bin/sh
set -e

if [ -n "$SSH_CLIENT" ] || [ -n "$SSH_TTY" ]; then
	# shellcheck disable=2068
	command lf $@
else
	[ ! -d "$HOME/.cache/lf" ] && mkdir --parents "$HOME/.cache/lf"
	# shellcheck disable=2016,2068
	command lf -command 'set_previewer sixel' $@ 3>&-
fi