Skip to content

Commit

Permalink
fzf-preview.sh: Check the number of arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
junegunn committed Oct 29, 2023
1 parent 9a95cd5 commit 1cfa3ee
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion bin/fzf-preview.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 1cfa3ee

Please sign in to comment.