#!/usr/bin/env sh

# Description: Search file with fzf
#
# Dependencies: fzf
#
# Shell: POSIX compliant
#
# Author: Shi Yanling

sffpipe=$1

sffpipe_enter()
{
	printf ">%s\0" "$1" >"$sffpipe"
}

if ! fzf --version >/dev/null; then
	printf "Press Enter to continue "; read -r _x
	exit 0
fi
_path=$(fzf)
[ "$_path" ] && sffpipe_enter "$_path"
