nix/bin/yazi-pick-file
2025-12-04 14:31:38 -06:00

13 lines
376 B
Bash
Executable file

#!/bin/bash
# Pick file using yazi for neomutt attachment
tmpfile=/tmp/neomutt-yazi-pick
if [ -z "$1" ]; then
cd ~
yazi --chooser-file="$tmpfile" &&
awk 'BEGIN {printf "%s", "push "} {printf "%s", "<attach-file>\"" $0 "\"<enter>"}' "$tmpfile" >"${tmpfile}.cmd" &&
mv "${tmpfile}.cmd" "$tmpfile"
elif [ "$1" == "clean" ]; then
rm -f "$tmpfile"
fi