blob: 27a8f4732b98255919d919c280a5aee07dbc43fb (
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 -xcl)"
[ -z "$url" ] && exit 1
case $1 in
'c') printf '%s' "$url" | clipp ;;
'o') linkhandler "$url" ;;
*) echo "no option" ;;
esac
|