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