Explorar el Código

Add simple Quoted-Printable encoding/decoding function

Alois Mahdal hace 6 años
padre
commit
5e8dc77f1b
Se han modificado 1 ficheros con 12 adiciones y 0 borrados
  1. 12
    0
      dotfiles/bash/main.bashrc

+ 12
- 0
dotfiles/bash/main.bashrc Ver fichero

@@ -274,6 +274,18 @@ nljoin() {
274 274
       | fixnl -c
275 275
 }
276 276
 
277
+qpr() {
278
+    #
279
+    # Encode or decode (if $1 is '-d') message on stdin as Quoted Printable
280
+    #
281
+    local fn=encode
282
+    case $1 in
283
+        -d) fn=decode ;;
284
+        -*) echo 'usage: qpr [-d] <text' >&2; return 2 ;;
285
+    esac
286
+    perl -MMIME::QuotedPrint -pe "\$_=MIME::QuotedPrint::$fn(\$_);"
287
+}
288
+
277 289
 xop() {
278 290
     #
279 291
     # Common clipboard operations with fixnl() on top