Skip to content

Instantly share code, notes, and snippets.

@dmidlo
Created March 27, 2017 00:15
Show Gist options
  • Save dmidlo/cd5bd5c5dbcf175b1440ca206923d74d to your computer and use it in GitHub Desktop.
Save dmidlo/cd5bd5c5dbcf175b1440ca206923d74d to your computer and use it in GitHub Desktop.
Googler Zsh Completions
#compdef googler
#
# Completion definition for googler.
#
# Author:
# Zhiming Wang
#
setopt localoptions noshwordsplit noksharrays
local -a args
args=(
'(- : *)'{-h,--help}'[show help text and exit]'
'(-s --start)'{-s,--start}'[start at the Nth result]:result number'
'(-n --count)'{-n,--count}'[show specified number of results (default 10)]:count'
'(-N --news)'{-N,--news}'[show results from news section]'
'(-c --tld)'{-c,--tld}'[country-specific search with top-level domain]:top level domain without dot'
'(-l --lang)'{-l,--lang}'[display in specified language]:language code'
'(-x --exact)'{-x,--exact}'[disable automatic spelling correction]'
'(-C --nocolor)'{-C,--nocolor}'[disable color output]'
'(--colors)--colors[set output colors]:six-letter string'
'(-j --first --lucky)'{-j,--first,--lucky}'[open the first result in a web browser]'
'(-t --time)'{-t,--time}'[time limit search]:period (h/d/w/m/y + number)'
'(-w --site)'{-w,--site}'[search a site using Google]:domain'
'(-p --proxy)'{-p,--proxy}'[proxy in HOST:PORT format]:proxy details'
'(--noua)--noua[disable user agent]'
'(--notweak)--notweak[disable TCP optimizations, forced TLS 1.2]'
'(--json --exact --np --noprompt)--json[output in JSON format; implies --exact and --noprompt]'
'(--show-browser-logs)--show-browser-logs[do not suppress browser output]'
'(--np --noprompt)'{--np,--noprompt}'[perform search and exit, do not prompt for further interactions]'
'(-u --upgrade)'{-u,--upgrade}'[perform in-place self-upgrade]'
'(--include-git)--include-git[when used with --upgrade, upgrade to git master]'
'(- : *)'{-v,--version}'[show version number and exit]'
'(-d --debug)'{-d,--debug}'[enable debugging]'
'*: :_guard "^-*" keyword'
)
_arguments -S -s $args
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment