#compdef GeoBase

B_BASES="(<%=BASES.join(' ')%>)"
F_FIELDS="(<%=FIELDS.join(' ')%>)"
N_RADIUS="(10 20 30 40 50)"
C_CLOSEST="(10 20 30 40 50)"
F_FUZZY="(0.5 0.6 0.7 0.8 0.9)"
T_TREP="(F S I J)"
L_LIMIT="(1 2 5)"
I_INT="()"
Q_QUIET="()"
Y_FIELDS="(dmetaphone dmetaphone-strict metaphone nysiis)"

_arguments \
 "(-h --help)"{-h,--help}"[Show this help message and exit]" \
 "(-b --base)"{-b,--base}"[Choose a different base, default is \"ori_por\"]:base:$B_BASES" \
 "(-f --fuzzy)"{-f,--fuzzy}"[Fuzzy search on --fuzzy-property field. Default property is \"name\"]:fuzzy value:()" \
 "(-F --fuzzy-property)"{-F,--fuzzy-property}"[Specify a property for fuzzy searches]:fuzzy property:$F_FIELDS" \
 "(-L --fuzzy-limit)"{-L,--fuzzy-limit}"[Specify a min limit for fuzzy searches, default is "0.80". This is a Levenshtein ratio.]:fuzzy limit (%%):$F_FUZZY" \
 "(-p --phonetic)"{-p,--phonetic}"[Phonetic search on --phonetic-property field. Default property is \"name\"]:phonetic value:()" \
 "(-P --phonetic-property)"{-P,--phonetic-property}"[Specify a property for phonetic searches]:phonetic property:$F_FIELDS" \
 "(-y --phonetic-method)"{-y,--phonetic-method}"[Change sound matching method]:method:$Y_FIELDS" \
 "(-e --exact)"{-e,--exact}"[Exact search on --exact-property. Default property is \"__key__\"]:exact value:()" \
 "(-E --exact-property)"{-E,--exact-property}"[Specify a property for exact searches]:*:exact property:$F_FIELDS" \
 "(-r --reverse)"{-r,--reverse}"[When possible, reverse the logic of the filter]" \
 "(-A --any)"{-A,--any}"[Change *and* behavior to *or* behavior for multiple --exact]" \
 "(-n --near)"{-n,--near}"[Radius search, give an argument with \"lat, lng\" or key]:near point:()" \
 "(-N --near-limit)"{-N,--near-limit}"[Specify a radius in km for radius searches.]:near limit (km):$N_RADIUS" \
 "(-c --closest)"{-c,--closest}"[Closest entries search, give an argument with \"lat, lng\" or key]:from point:()" \
 "(-C --closest-limit)"{-C,--closest-limit}"[Number of closest points searched with --closest.]:closest limit (nb):$C_CLOSEST" \
 "(-w --without-grid)"{-w,--without-grid}"[Disable grid for geographical searches]" \
 "(-t --trep)"{-t,--trep}"[OpenTrep mode]:value:()" \
 "(-T --trep-format)"{-T,--trep-format}"[Specify a format for trep searches, default is \"S\".]:trep format:$T_TREP" \
 "(-o --omit)"{-o,--omit}"[Omit some fields in output]:*:fields:$F_FIELDS" \
 "(-s --show)"{-s,--show}"[Only display some fields in output]:*:fields:$F_FIELDS" \
 "(-l --limit)"{-l,--limit}"[Specify a limit in the number of results]:limit (nb):$L_LIMIT" \
 "(-i --indexation)"{-i,--indexation}"[Specify metadata for stdin data input.]:*:delimiter headers key_fields discard_dups indices:$I_INT" \
 "(-I --interactive-query)"{-I,--interactive-query}"[stdin data is keys for query, not data input]:*:field __exact__/__fuzzy__/__phonetic__:$F_FIELDS" \
 "(-q --quiet)"{-q,--quiet}"[Programmer friendly output]" \
 "(-Q --quiet-options)"{-Q,--quiet-options}"[Custom quiet mode]:*:delimiter header:$Q_QUIET" \
 "(-m --map)"{-m,--map}"[Display points on a map]" \
 "(-M --map-options)"{-M,--map-options}"[Custom map display]:*:label weight color icon duplicates:$F_FIELDS" \
 "(-v --verbose)"{-v,--verbose}"[Provide additional informations during data loading and queries]" \
 "(-u --update)"{-u,--update}"[Try to update the data files]" \
 "(-U --update-forced)"{-U,--update-forced}"[Force the update of all data files]" \
 "(-V --version)"{-V,--version}"[Display version information]" \
 "*:keys:()"

# Magic modeline option lo use zsh coloration in vim
# vim: ft=zsh
