nnn/plugins/mimelist

22 lines
451 B
Plaintext
Raw Normal View History

#!/usr/bin/env sh
# Description: Run fd/find in subtree and list files by mime type in smart context
2020-05-06 05:29:57 +00:00
# Dependencies: fd/find
#
# Shell: POSIX compliant
2020-05-04 00:47:38 +00:00
# Author: Arun Prakash Jana
. "$(dirname "$0")"/.nnn-plugin-helper
if [ "$(cmd_exists fd)" -eq "0" ]; then
fd=fd
else
fd=find
fi
2020-11-12 02:47:14 +00:00
printf "mime (e.g., video/audio/image): "
read -r mime
printf "%s" "+l" > "$NNN_PIPE"
$fd | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE"