Pārlūkot izejas kodu

Add simple Quoted-Printable encoding/decoding function

Alois Mahdal 6 gadus atpakaļ
vecāks
revīzija
5e8dc77f1b
1 mainītis faili ar 12 papildinājumiem un 0 dzēšanām
  1. 12
    0
      dotfiles/bash/main.bashrc

+ 12
- 0
dotfiles/bash/main.bashrc Parādīt failu

@@ -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