#compdef googler
#
# Completion definition for googler.
#
# Author:
#   Zhiming Wang <zmwangx@gmail.com>
#

setopt localoptions noshwordsplit noksharrays
local -a args
args=(
    '(- : *)'{-h,--help}'[show help text and exit]'
    '(-c --tld)'{-c,--tld}'[country-specific search with top-level domain]:top level domain without dot'
    '(-C --nocolor --colors)'{-C,--nocolor}'[disable color output]'
    '(-C --nocolor)--colors[set output colors]:six-letter string'
    '(-d --debug)'{-d,--debug}'[enable debugging]'
    '(-j --first --lucky)'{-j,--first,--lucky}'[open the first result in a web browser]'
    '(--json --np --noprompt)--json[output in JSON format; implies --noprompt]'
    '(-l --lang)'{-l,--lang}'[display in specified language]:language code'
    '(-n --count)'{-n,--count}'[show specified number of results (default 10)]:count'
    '(-N --news)'{-N,--news}'[show results from news section]'
    '(--np --noprompt)'{--np,--noprompt}'[perform search and exit, do not prompt for further interactions]'
    '(-p --proxy)'{-p,--proxy}'[proxy in HOST:PORT format]:proxy details'
    '(-s --start)'{-s,--start}'[start at the Nth result]:result number'
    '(-t --time)'{-t,--time}'[time limit search]:period (h/d/w/m/y + number)'
    '(-w --site)'{-w,--site}'[search a site using Google]:domain'
    '(-x --exact)'{-x,--exact}'[disable automatic spelling correction]'
    '*: :_guard "^-*" keyword'
)
_arguments -S -s $args
