blob: d261e32b81380c22ba634fe245c2ee84257af283 (
plain)
1
2
3
4
5
6
7
8
9
10
11
|
#!/bin/sh
regex='(((file|https?|gopher|gemini|ftps?|git)://|www\.)[a-zA-Z0-9.]*[:;!a-zA-Z0-9./+@$&%?$\#=_~-]*)|(magnet:\?xt=urn:btih:[a-zA-Z0-9]*)'
url="$(tr -d '\n' | grep -Eo "$regex" | commander -cl)"
[ -z "$url" ] && exit 1
case $1 in
'c') printf '%s' "$url" | clipp ;;
'o') linkhandler "$url" ;;
*) echo "no option" ;;
esac
|