#compdef GeoBase

B_BASES="(airlines airports cabins capitals cities continents countries currencies feature_classes feature_codes geonames_FR geonames_MC languages locales location_types ori_por ori_por_multi ori_por_non_iata postal_codes_FR postal_codes_MC stations stations_nls stations_uic timezones)"
F_FIELDS="(__key__ __dup__ __dad__ __lno__ iata_code icao_code faa_code is_geonames geoname_id valid_id name asciiname lat lng fclass fcode page_rank date_from date_until comment country_code cc2 country_name adm1_code adm1_name_utf adm1_name_ascii adm2_code adm2_name_utf adm2_name_ascii adm3_code adm4_code population elevation gtopo30 timezone gmt_offset dst_offset raw_offset moddate city_code city_name_utf city_name_ascii tvl_por_list state_code location_type wiki_link alt_name_section alt_name_section@raw tvl_por_list@raw __gar__)"
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="()"

_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" \
 "(-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" \
 "(-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" \
 "(-g --gridless)"{-g,--gridless}"[Disabling grid for nearby searches]" \
 "(-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 --indexes)"{-i,--indexes}"[Specify metadata for stdin data input.]:*:delimiter headers indexes discard_dups:$I_INT" \
 "(-I --interactive-query)"{-I,--interactive-query}"[stdin data is keys for query, not considered as data input]:*:field __exact__/__fuzzy__:$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-data)"{-M,--map-data}"[Custom map display]:*:label size color icon duplicates:$F_FIELDS" \
 "(-w --warnings)"{-w,--warnings}"[Provide additional informations from data loading]" \
 "(-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
