summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/fzf-preview.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/bin/fzf-preview.sh b/bin/fzf-preview.sh
index bd12e3bc..1818f044 100755
--- a/bin/fzf-preview.sh
+++ b/bin/fzf-preview.sh
@@ -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