From 72895223808d2b76a48d1eb54159313057e26a18 Mon Sep 17 00:00:00 2001 From: Marty Oehme Date: Wed, 24 Sep 2025 10:23:39 +0200 Subject: [PATCH] mail: Add mail- prefix to mail cli utilities Rename mail utility programs (yet again), to be prefixed with `mail-` instead of `neomutt-`. Also did not substitute with other MUA like `aerc-` since these utilities are mostly independent of specific implementations. The very specific `neomutt-filer` implementation script I completely removed since for aerc the same can be achieved with a simple configuration option. --- office/.config/aerc/binds.conf | 4 +- .../{neomutt-renderhtml => mail-renderhtml} | 2 +- .../.local/bin/{neomutt-2task => mail-totask} | 6 +- office/.local/bin/neomutt-filer | 73 ------------------- 4 files changed, 6 insertions(+), 79 deletions(-) rename office/.local/bin/{neomutt-renderhtml => mail-renderhtml} (93%) rename office/.local/bin/{neomutt-2task => mail-totask} (92%) delete mode 100755 office/.local/bin/neomutt-filer diff --git a/office/.config/aerc/binds.conf b/office/.config/aerc/binds.conf index a33819f..1a2d6a4 100644 --- a/office/.config/aerc/binds.conf +++ b/office/.config/aerc/binds.conf @@ -118,8 +118,8 @@ s = :split S = :vsplit # send mails to taskwarrior -,t = :pipe -s -m neomutt-2task -c -d -t -,T = :pipe -s -m neomutt-2task -c +,t = :pipe -s -m mail-totask -c -d -t +,T = :pipe -s -m mail-totask -c # # TODO: Investigate use # pl = :patch list diff --git a/office/.local/bin/neomutt-renderhtml b/office/.local/bin/mail-renderhtml similarity index 93% rename from office/.local/bin/neomutt-renderhtml rename to office/.local/bin/mail-renderhtml index 9d4a7a0..0289a61 100755 --- a/office/.local/bin/neomutt-renderhtml +++ b/office/.local/bin/mail-renderhtml @@ -3,7 +3,7 @@ # requires: html2text, glow or bat # author: CEUK -fpath=$(mktemp --suffix=-neomutt-render.html) +fpath=$(mktemp --suffix=-mail-render.html) #shellcheck disable=SC2064 # we want to expand it instantly trap "rm -f -- ${fpath@Q}" EXIT diff --git a/office/.local/bin/neomutt-2task b/office/.local/bin/mail-totask similarity index 92% rename from office/.local/bin/neomutt-2task rename to office/.local/bin/mail-totask index 71fc583..3e329e0 100755 --- a/office/.local/bin/neomutt-2task +++ b/office/.local/bin/mail-totask @@ -5,9 +5,9 @@ Creates a new task with corresponding description and tags. Description and tags can be supplied via commandline through `-d` and `-t` options, or interactively by using the options without supplying a string for them. E.g.: -`mutt2task` => task: Reply to from -`mutt2task -d "hello" -t one two` => task: hello +one +two -`mutt2task -d -t` => asks you interactively for description and tags +`mail-totask` => task: Reply to from +`mail-totask -d "hello" -t one two` => task: hello +one +two +`mail-totask -d -t` => asks you interactively for description and tags """ import argparse diff --git a/office/.local/bin/neomutt-filer b/office/.local/bin/neomutt-filer deleted file mode 100755 index 02f6105..0000000 --- a/office/.local/bin/neomutt-filer +++ /dev/null @@ -1,73 +0,0 @@ -#!/usr/bin/env bash -# A simple utility script for neomutt to use your favorite cli -# file manager to work with files in neomutt. -# Can add attachments to emails or save attachments in a chosen directory. -# -# Use it as `neomutt-filer attach ` -# or `neomutt-filer saveto ` -# -# Can be bound to neomutt macros like the following: -# -# macro compose A 'source "neomutt-filer attach"|' "Attach with file manager" -# macro attach S 'source "neomutt-filer saveto"|' "Save attachment to dir" -# -# read more at the following GH issues: -# https://github.com/neomutt/neomutt/issues/1515 -- switch folders with external program -# https://github.com/neomutt/neomutt/issues/1669 -- attach files with fzf - -_file_picker() { - if command -v vifm >/dev/null 2>&1; then - vifm --choose-files - "$@" - # yazi & ranger untested - elif command -v yazi >/dev/null 2>&1; then - yazi "$@" --chooser-file - - elif command -v ranger >/dev/null 2>&1; then - ranger --choosefiles - "$@" - elif command -v fzf >/dev/null 2>&1; then - fzf -m --prompt='Choose one/multiple file(s) to attach >' "$@" - fi -} -_dir_picker() { - if command -v vifm >/dev/null 2>&1; then - vifm --choose-dir - --on-choose exit "$@" - # yazi & ranger untested - # elif command -v yazi >/dev/null 2>&1; then - # yazi "$@" --chooser-file - - # elif command -v ranger >/dev/null 2>&1; then - # ranger --choosefiles - "$@" - elif command -v fzf >/dev/null 2>&1; then - find "$@" -type d -print | fzf --prompt='Choose dir >' - fi -} - -attachfile() { - _file_picker "$@" | - while IFS=$'\n' read -r attachment; do - printf "push '%s'\n" "$attachment" - done -} - -savetodir() { - _dir_picker "$@" | xargs printf "push '%sy'\n" -} - -_usage() { - echo """ -Usage: neomutt-filer [options...] -Subcommands: - attach Pick files to attach - saveto Pick a directory to save into - """ -} - -case "${1:-}" in -attach) - shift - attachfile "$@" - ;; -saveto) - shift - savetodir "$@" - ;; --h | --help | *) _usage ;; -esac