diff options
| author | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-30 00:05:20 +0900 |
|---|---|---|
| committer | Junegunn Choi <junegunn.c@gmail.com> | 2023-10-30 00:05:54 +0900 |
| commit | 1cfa3ee4c7c1741fca3cd26fb13451621d14bbf2 (patch) | |
| tree | 0f2ef752285686d59366ba4d8f9f5afe9844698c /bin | |
| parent | 9a95cd579439edfb1963678b9a5ddecd89e13bf9 (diff) | |
| download | fzf-1cfa3ee4c7c1741fca3cd26fb13451621d14bbf2.tar.gz | |
fzf-preview.sh: Check the number of arguments
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/fzf-preview.sh | 7 |
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 |
