mirror of
https://github.com/jarun/nnn.git
synced 2024-11-18 08:59:14 +00:00
22 lines
423 B
Plaintext
22 lines
423 B
Plaintext
|
#!/usr/bin/env sh
|
||
|
|
||
|
# Description: Run fd/find in subtree and list files by mime type in current context
|
||
|
# Requires: fd/find
|
||
|
#
|
||
|
# Shell: POSIX compliant
|
||
|
# Author: Arun Prakash jana
|
||
|
|
||
|
. "$(dirname "$0")"/.nnn-plugin-helper
|
||
|
|
||
|
if [ "$(cmd_exists fd)" -eq "0" ]; then
|
||
|
fd=fd
|
||
|
else
|
||
|
fd=find
|
||
|
fi
|
||
|
|
||
|
printf "mime: "
|
||
|
read -r mime
|
||
|
|
||
|
printf "%s" "0l" > "$NNN_PIPE"
|
||
|
$fd | file -if- | grep "$mime" | awk -F: '{printf "%s\0", $1}' > "$NNN_PIPE"
|