From 9d3cf48e38cb50aaeba988c7b3f575c3d7c4ca05 Mon Sep 17 00:00:00 2001 From: Daniel Fichtinger Date: Sat, 29 Mar 2025 14:45:07 -0400 Subject: [PATCH] AutoYADM commit: 2025-03-29 14:45:07 --- .config/fish/functions/pb.fish | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/.config/fish/functions/pb.fish b/.config/fish/functions/pb.fish index 4ce6a4cb..89d70f87 100644 --- a/.config/fish/functions/pb.fish +++ b/.config/fish/functions/pb.fish @@ -1,3 +1,6 @@ +# This function lets the user conveniently upload a paste to sr.ht, +# and copy its url. You can also copy the url of a paste +# you've already uploaded. function pb --description 'Upload a paste to sr.ht' set -l cmd $argv[1] set -l args $argv[2..] @@ -30,12 +33,14 @@ function pb --description 'Upload a paste to sr.ht' set --function list $list $append end end - printf '%s\n' $list - set -l selection (echo $list | fzf) - echo $selection + set -l selection (printf '%s\n' $list | fzf) + set -l hash (string split ' ' $selection)[2] + set -l srht_user (string split ' ' (hut meta show)[1])[1] + set -l url "https://paste.sr.ht/$srht_user/$hash" + string trim $url | wl-copy + echo "$url copied to clipboard." case '*' echo 'Unhandled case!' - # echo ">$cmd<" false return end