aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mimelist
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/mimelist')
-rwxr-xr-xplugins/mimelist21
1 files changed, 21 insertions, 0 deletions
diff --git a/plugins/mimelist b/plugins/mimelist
new file mode 100755
index 0000000..0ec7c0f
--- /dev/null
+++ b/plugins/mimelist
@@ -0,0 +1,21 @@
+#!/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"