From 0a1489f3368db241d04af1f43b9c19006969bcd2 Mon Sep 17 00:00:00 2001 From: Michael Wales Date: Wed, 27 Nov 2013 12:51:17 -0600 Subject: [PATCH] Added CanIUse plugin --- plugins/caniuse/caniuse.plugin.zsh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 plugins/caniuse/caniuse.plugin.zsh diff --git a/plugins/caniuse/caniuse.plugin.zsh b/plugins/caniuse/caniuse.plugin.zsh new file mode 100644 index 00000000..2130c51c --- /dev/null +++ b/plugins/caniuse/caniuse.plugin.zsh @@ -0,0 +1,23 @@ +# CanIUse.com Command Line Search Utility +# Michael Wales, http://github.com/walesmd +# +# A very basic bash function that quickly searches http://caniuse.com/ +# +# Examples: +# caniuse +# caniuse border-radius +# caniuse "alpha transparency" counters "canvas drawings" html svg + +caniuse() { + local domain="http://caniuse.com/" + local query + + if [ $# -eq 0 ]; then + open ${domain} + else + for term in "$@"; do + query=$(python -c "import sys, urllib as ul; print ul.quote('${term}');") + open "${domain}#search=${query}" + done + fi +}