fzf-preview.sh: Check the number of arguments

This commit is contained in:
Junegunn Choi 2023-10-30 00:05:20 +09:00
parent 9a95cd5794
commit 1cfa3ee4c7
No known key found for this signature in database
GPG Key ID: 254BC280FEF9C627
1 changed files with 6 additions and 1 deletions

View File

@ -7,7 +7,12 @@
# - https://github.com/hpjansson/chafa
# - https://github.com/sharkdp/bat
file=$1
if [[ $# -ne 1 ]]; then
>&2 echo "usage: $0 FILENAME"
exit 1
fi
file=${1/#\~\//$HOME/}
type=$(file --mime-type "$file")
if [[ ! $type =~ image/ ]]; then