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