xxwhirlpool
·
2026-03-25
mdquote
1#!/usr/bin/env bash
2
3tempfile=$(mktemp --suffix .md)
4
5logic() {
6 gum write --header "paste text here" > "$tempfile"
7 if [[ -f "$tempfile" ]]; then
8 while read -r "ln"; do
9 if [[ ! "$ln" == "" ]]; then
10 echo "> $ln"
11 else
12 echo ""
13 fi
14 done < "$tempfile"
15 rm "$tempfile"
16 else
17 echo "Usage: mdquote [PASTE TEXT]"
18 exit 1
19 fi
20}
21
22logic | perl -pe "chomp if eof" | tee >(xclip -selection clipboard)