3535 content=" $( tmux capture-pane -J -p -S -" $limit " ) "
3636fi
3737
38- mapfile -t urls < < ( echo " $content " | grep -oE ' (https?|ftp|file):/?//[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]' )
39- mapfile -t wwws < < ( echo " $content " | grep -oE ' (http?s://)?www\.[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}(/\S+)*' | grep -vE ' ^https?://' | sed ' s/^\(.*\)$/http:\/\/\1/' )
40- mapfile -t ips < < ( echo " $content " | grep -oE ' [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]{1,5})?(/\S+)*' | sed ' s/^\(.*\)$/http:\/\/\1/' )
41- mapfile -t gits < < ( echo " $content " | grep -oE ' (ssh://)?git@\S*' | sed ' s/:/\//g' | sed ' s/^\(ssh\/\/\/\)\{0,1\}git@\(.*\)$/https:\/\/\2/' )
38+ urls= $ ( echo " $content " | grep -oE ' (https?|ftp|file):/?//[-A-Za-z0-9+&@#/%?=~_|!:,.;]*[-A-Za-z0-9+&@#/%=~_|]' )
39+ wwws= $ ( echo " $content " | grep -oE ' (http?s://)?www\.[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}(/\S+)*' | grep -vE ' ^https?://' | sed ' s/^\(.*\)$/http:\/\/\1/' )
40+ ips= $ ( echo " $content " | grep -oE ' [0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}(:[0-9]{1,5})?(/\S+)*' | sed ' s/^\(.*\)$/http:\/\/\1/' )
41+ gits= $ ( echo " $content " | grep -oE ' (ssh://)?git@\S*' | sed ' s/:/\//g' | sed ' s/^\(ssh\/\/\/\)\{0,1\}git@\(.*\)$/https:\/\/\2/' )
4242
4343if [[ $# -ge 1 && " $1 " != ' ' ]]; then
44- mapfile -t extras < < ( echo " $content " | eval " $1 " )
44+ extras= $ ( echo " $content " | eval " $1 " )
4545fi
4646
4747items=$( printf ' %s\n' " ${urls[@]} " " ${wwws[@]} " " ${ips[@]} " " ${gits[@]} " " ${extras[@]} " |
@@ -51,7 +51,7 @@ items=$(printf '%s\n' "${urls[@]}" "${wwws[@]}" "${ips[@]}" "${gits[@]}" "${extr
5151)
5252[ -z " $items " ] && tmux display ' tmux-fzf-url: no URLs found' && exit
5353
54- mapfile -t chosen < < ( fzf_filter <<< " $items" | awk ' {print $2}' )
54+ chosen= $ ( fzf_filter <<< " $items" | awk ' {print $2}' )
5555
5656for item in " ${chosen[@]} " ; do
5757 open_url " $item " & > " /tmp/tmux-$( id -u) -fzf-url.log"
0 commit comments