plumber

Plumber – a modern approach to plumbing
git clone git://r-36.net/plumber
Log | Files | Refs | LICENSE

commit c6d9c3fbe01c9efe930dfb698e6cdebcaf47450a
parent 26f68d9cb341610d35aab0bd615b881d25dbe0c2
Author: Christoph Lohmann <20h@r-36.net>
Date:   Tue, 10 Apr 2018 20:42:44 +0200

Add more openers, dictopener is more flexible.

Diffstat:
bin/plumber | 13++++++-------
openers/dictopener | 16+++++++++++++++-
2 files changed, 21 insertions(+), 8 deletions(-)

diff --git a/bin/plumber b/bin/plumber @@ -34,19 +34,18 @@ plumbrules = [ ["^gopher://.*", "gopheropener '%s'"], ["^http://sprunge.us/.*", "textwebopener '%s'"], ["^http://ix.io/.*", "textwebopener '%s'"], - ["^http://.*", "webopener '%s'"], - ["^https://.*", "webopener '%s'"], + ["^http(|s)://www.youtube.com/watch.*", "ytopener '%s'"], + ["^http(|s)://www.youtube.com/embed/.*", "ytopener '%s'"], + ["^http(|s)://.*", "webopener '%s'"], ["^mailto:.*", "mailcomposer '%s'"], ["^dance:.*", "danceopener '%s'"], - ["^dict://.*", "dictopener '%s'"], + ["^dict:.*", "dictopener '%s'"], ["^dhl:.*", "dhlopener '%s'"], ["^doi:.*", "doiopener '%s'"], ["^finger://.*", "fingeropener '%s'"], - ["^ftp://.*", "ftpopener '%s'"], - ["^ftps://.*", "ftpopener '%s'"], + ["^ftp(|s)://.*", "ftpopener '%s'"], ["^sftp://.*", "ftpopener '%s'"], - ["^ldap://.*", "ldapopener '%s'"], - ["^ldaps://.*", "ldapopener '%s'"], + ["^ldap(|s)://.*", "ldapopener '%s'"], ["^moz://:*", "mozopener '%s'"], ["^mms://.*", "mediaopener '%s'"], ["^paper:.*", "paperopener '%s'"], diff --git a/openers/dictopener b/openers/dictopener @@ -6,5 +6,19 @@ then exit 1 fi -st -e sh -c "dict \"$1\"; read;" +uri="$1" +case "$uri" in +dict://*) + argument="$uri" + ;; +dict:*) + argument="$(printf "%s\n" "$uri" | cut -d':' -f 2-)" + ;; +*) + argument="$uri" + ;; +esac + +[ -z "$PAGER" ] && PAGER="less" +st -e sh -c "dict \"$argument\" | $PAGER"