#!/bin/sh
# Finds all URLs in stdin and prompts a dmenu choice, then writes the selected
# url to stdout.
# Usage: dmenu-urlselect [-m menu]
# Requires: dmenu (or similar), urlgrep
menu="dmenu -i -l 20"
while getopts "m:" opt; do
case "$opt" in
m)
menu="$OPTARG"
;;
esac
done
shift `expr $OPTIND - 1`
urlgrep | $menu