From 3fe7111206c8767f35fae6b3da296ae8910210aa Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Sat, 29 Mar 2025 14:15:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-29 14:15:07 --- .config/fish/functions/pb.fish | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .config/fish/functions/pb.fish diff --git a/.config/fish/functions/pb.fish b/.config/fish/functions/pb.fish new file mode 100644 index 00000000..13baf787 --- /dev/null +++ b/.config/fish/functions/pb.fish @@ -0,0 +1,25 @@ +function pb --description 'Upload a paste to sr.ht' + set -l cmd $argv[1] + set -l args $argv[2..] + switch $cmd + case create + set -l output (hut paste create $args) + if not test $status = 0 + echo 'Error creating paste!' + false + return + end + set -l url (string match -r 'https://paste\.sr\.ht/.+/[a-zA-Z0-9]+$' $output) + echo $url | wl-copy + echo "$url copied to clipboard." + + case copy + set -l lines (string split \n (hut paste list)) + echo $lines + case '*' + echo 'Unhandled case!' + # echo ">$cmd<" + false + return + end +end