Recently Written · git

prompt-mail

Ask mail-related questions and filter mail-related files with dmenu

git clone https://github.com/equwal/prompt-mail

Log | Files | Refs


commit fce001c8700f4a7794ed3f18f614d22e1e735390
Spenser Truex <truex@equwal.com>
2022-08-10 13:17:19 -0300

Add support for ~ expansion

 Makefile    | 2 +-
 prompt-mail | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 4c16a1b..32810e5 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,6 @@ install:
 ${CFG_PATH}:
 	@echo -e "I have setup your toiling space ${CFG_PATH}\nEdit it, slave!"
 	@echo "#Comments must be at the beginning of the line." > ${CFG_PATH}
-	@echo "# No ~ expansion allowed." >> ${CFG_PATH}
+	@echo "# ~ expansion works." >> ${CFG_PATH}
 	@echo -e "# Example line:\n" >> ${CFG_PATH}
 	@echo "#${HOME}/.config/neomutt/aliases" >> ${CFG_PATH}
diff --git a/prompt-mail b/prompt-mail
index 1cdb9f9..74c92dc 100755
--- a/prompt-mail
+++ b/prompt-mail
@@ -10,8 +10,9 @@ verify_email () {
 }
 
 mail_addrs () {
-    sed 's/ *#.*//' ~/.config/prompt-mail.conf \
-        | xargs sed -E "s/^alias +[a-zA-Z0-9]+ // ; s/^#.*$// ; s/ +$//" \
+    sed 's/[\\t ]*#.*//' ~/.config/prompt-mail.conf \
+        | xargs sed -E "s/^alias[\\t ]+[a-zA-Z0-9]+[ \\t]+// ; s/[ \\t]+$//" \
+        | sed -E "s:~:$HOME:g" \
         | sort \
         | uniq
 }