Commit d4648a4
xxwhirlpool
·
2025-12-07 10:01:29 -0500 EST
parent 64a5671
add txt tool
1 files changed,
+21,
-0
+21,
-0
| ... | ... | @@ -0,0 +1,21 @@ | |
| 1 | + | #!/usr/bin/env bash | |
| 2 | + | ||
| 3 | + | unwraptxt() { | |
| 4 | + | TXTFILE="/tmp/$(openssl rand -hex 5).txt" | |
| 5 | + | TXTFILE_FIN="${TXTFILE%.*}_final.txt" | |
| 6 | + | gum write --header="paste wrapped text below" > "$TXTFILE" | |
| 7 | + | perl -00 -lpe 's/\n/ /g' < "$TXTFILE" > "$TXTFILE_FIN" | |
| 8 | + | batcat --paging=never "$TXTFILE_FIN" | |
| 9 | + | xclip -sel clip "$TXTFILE_FIN" | |
| 10 | + | rm "$TXTFILE" "$TXTFILE_FIN" | |
| 11 | + | } | |
| 12 | + | ||
| 13 | + | choice() { | |
| 14 | + | choose=$(gum choose "unwrap") | |
| 15 | + | case "$choose" in | |
| 16 | + | *unwrap) unwraptxt ;; | |
| 17 | + | *) exit 0;; | |
| 18 | + | esac | |
| 19 | + | } | |
| 20 | + | ||
| 21 | + | choice |