st

my build of st
git clone git://git.ckyln.com/st
Log | Files | Refs | README | LICENSE

st-url (415B)


      1 #!/bin/sh
      2 
      3 pick_url() {
      4     # sed 's/.*|//g' |
      5     grep -aEo '(((http|https)://|www\.)[a-zA-Z0-9.]*[:]?[a-zA-Z0-9./&%?=_-]*)|((magnet:\?xt=urn:btih:)[a-zA-Z0-9]*)' | uniq | sed 's|^www\.|http://www.|' | dmenu -i -p "$1 which url?" -l 10 || exit 1
      6 }
      7 
      8 case "$1" in
      9     o) xdg-open "$(pick_url Open)"  ;;
     10     c) pick_url Copy | tr -d '\n' | xclip -sel c ;;
     11     *) printf '%s\n' "usage: ${0##*/} [c|o]"; exit 1 ;;
     12 esac