Skip to content

Instantly share code, notes, and snippets.

@NigoroJr
Created February 17, 2016 19:57
Show Gist options
  • Select an option

  • Save NigoroJr/14d6ccda3c0d64c1e727 to your computer and use it in GitHub Desktop.

Select an option

Save NigoroJr/14d6ccda3c0d64c1e727 to your computer and use it in GitHub Desktop.
Wrapper for starting Chrome in Mac
#!/usr/bin/env zsh
local opts addr
opts='--incognito'
while getopts 'hs:g:n' flag; do
case "$flag" in
n)
opts=''
;;
s)
addr="https://google.com/search?q=$( echo $OPTARG | perl -p -e 's/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' )"
;;
g)
addr="https://github.com/$OPTARG"
;;
h)
echo "Usage: $0 [-h] [-s <search keyword>] [-g <github user/repo>] args"
exit 0
esac
done
shift $(( $OPTIND - 1 ))
~/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome $@ $opts $addr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment