Created
February 17, 2016 19:57
-
-
Save NigoroJr/14d6ccda3c0d64c1e727 to your computer and use it in GitHub Desktop.
Wrapper for starting Chrome in Mac
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/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