# shellcheck shell=bash disable=SC2148
# WARNING: File auto-generated by completionFinder.py, do not modify manually


if ! ps -p $$ >/dev/null 2>/dev/null; then
  # For busybox
  CURRENT_SHELL="bash"
else
  CURRENT_SHELL="$(sh -c 'ps -p $$ -o ppid=' | xargs ps -o comm= -p)"
fi

if [ "$CURRENT_SHELL" = "zsh" ]; then
  autoload -U bashcompinit
  bashcompinit
fi

HAS_GET_COMP_WORDS_BY_REF=no
if [ "$CURRENT_SHELL" = "bash" ]; then
  function_exists() {
      declare -f -F "$1" > /dev/null
      return $?
  }

  # Checks that bash-completion is recent enough
  if function_exists _get_comp_words_by_ref; then
    HAS_GET_COMP_WORDS_BY_REF=yes;
  fi
fi

_gdal()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"

  if test "$HAS_GET_COMP_WORDS_BY_REF" = "yes"; then
    local cur prev
    _get_comp_words_by_ref cur prev
    if test "$cur" = ""; then
      extra="last_word_is_complete=true"
    else
      extra="prev=${prev} cur=${cur}"
    fi
    choices=$(gdal completion ${COMP_LINE} ${extra})
  else
    choices=$(gdal completion ${COMP_LINE})
  fi
  if [ "$CURRENT_SHELL" = "bash" ]; then
    if [[ "$cur" == "=" ]]; then
      mapfile -t COMPREPLY < <(compgen -W "$choices" --)
    elif [[ "$cur" == ":" ]]; then
      mapfile -t COMPREPLY < <(compgen -W "$choices" --)
    elif [[ "$cur" == "!" ]]; then
      mapfile -t COMPREPLY < <(compgen -W "$choices" -P "! " --)
    else
      mapfile -t COMPREPLY < <(compgen -W "$choices" -- "$cur")
    fi
    for element in "${COMPREPLY[@]}"; do
      if [[ $element == */ ]]; then
        # Do not add a space if one of the suggestion ends with slash
        compopt -o nospace
        break
      elif [[ $element == *= ]]; then
        # Do not add a space if one of the suggestion ends with equal
        compopt -o nospace
        break
      elif [[ $element == *: ]]; then
        # Do not add a space if one of the suggestion ends with colon
        compopt -o nospace
        break
      fi
    done
  else
    # zsh
    if [ "$cur" = "=" ]; then
      COMPREPLY=( "$(compgen -W "$choices" --)" )
    elif [ "$cur" = ":" ]; then
      COMPREPLY=( "$(compgen -W "$choices" --)" )
    elif [ "$cur" = "!" ]; then
      COMPREPLY=( "$(compgen -W "$choices" -P "! " --)" )
    else
      COMPREPLY=( "$(compgen -W "$choices" -- "$cur")" )
    fi
    for element in "${COMPREPLY[@]}"; do
      if [[ $element == */ ]]; then
        # Do not add a space if one of the suggestion ends with slash
        _COMP_OPTIONS+=(nospace)
        break
      elif [[ $element == *= ]]; then
        # Do not add a space if one of the suggestion ends with equal
        _COMP_OPTIONS+=(nospace)
        break
      elif [[ $element == *: ]]; then
        # Do not add a space if one of the suggestion ends with colon
        _COMP_OPTIONS+=(nospace)
        break
      fi
    done
  fi
}

# nosort requires bash 4.4
complete -o nosort -o default -F _gdal gdal 2>/dev/null || complete -o default -F _gdal gdal

_gdal2tiles()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list=""
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _gdal2tiles gdal2tiles.py
complete -o default -F _gdal2tiles gdal2tiles
_gdal2xyz()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -skip -srcwin -b -allbands -csv -skipnodata -srcnodata -dstnodata --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal2xyz gdal2xyz.py
complete -o default -F _gdal2xyz gdal2xyz
_gdaladdo()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -r -ro --quiet -b -oo -minsize -clean --partial-refresh-from-source-timestamp --partial-refresh-from-projwin --partial-refresh-from-source-extent --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdaladdo gdaladdo
_gdalbuildvrt()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --quiet -strict -non_strict -tile_index -resolution -tr -input_file_list -separate -pixel-function -pixel-function-arg -allow_projection_difference -sd -tap -te -addalpha -b -hidenodata -overwrite -srcnodata -vrtnodata -a_srs -r -oo -co -write_absolute_path -ignore_srcmaskband -nodata_max_mask_threshold --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalbuildvrt gdalbuildvrt
_gdal_calc()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -a --a_band -b --b_band -c --c_band -d --d_band -e --e_band -f --f_band -g --g_band -h --h_band -i --i_band -j --j_band -k --k_band -l --l_band -m --m_band -n --n_band -o --o_band -p --p_band -q --q_band -r --r_band -s --s_band -t --t_band -u --u_band -v --v_band -w --w_band -x --x_band -y --y_band -z --z_band -A --A_band -B --B_band -C --C_band -D --D_band -E --E_band -F --F_band -G --G_band -H --H_band -I --I_band -J --J_band -K --K_band -L --L_band -M --M_band -N --N_band -O --O_band -P --P_band -Q --Q_band -R --R_band -S --S_band -T --T_band -U --U_band -V --V_band -W --W_band -X --X_band -Y --Y_band -Z --Z_band --NoDataValue --hideNoData --type --format --creation-option --allBands --overwrite --debug --quiet --color-table --extent --projectionCheck --version --build --license --formats --optfile --config --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -f)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_calc gdal_calc.py
complete -o default -F _gdal_calc gdal_calc
_gdalcompare()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -dumpdiffs -skip_binary -skip_overviews -skip_geolocation -skip_geotransform -skip_metadata -skip_rpc -skip_srs -sds --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalcompare gdalcompare.py
complete -o default -F _gdalcompare gdalcompare
_gdal_config()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--prefix --libs --dep-libs --cflags --datadir --version --ogr-enabled --gnm-enabled --formats --plugindir "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _gdal_config gdal-config
_gdal_contour()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -b -a -amin -amax -3d -inodata -snodata -i -e -fl -off -nln -p -gt --quiet -oo -dsco -of -co -lco --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_contour gdal_contour
_gdaldem()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdaldem gdaldem
_gdal_edit()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -ro -a_srs -a_ullr -a_ulurll -tr -unsetgt -unsetrpc -a_nodata -unsetnodata -offset -scale -units -colorinterp_<X> -a_coord_epoch -unsetepoch -unsetstats -stats -approx_stats -setstats -gcp -unsetmd -oo -mo --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_edit gdal_edit.py
complete -o default -F _gdal_edit gdal_edit
_gdalenhance()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -of -co -ot -equalize -config --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalenhance gdalenhance
_gdal_fillnodata()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -q -md -si -o -mask -interp -b -of -co --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_fillnodata gdal_fillnodata.py
complete -o default -F _gdal_fillnodata gdal_fillnodata
_gdal_grid()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --quiet -of -ot -txe -tye -outsize -tr -co -zfield -z_increase -z_multiply -where -l -sql -spat -clipsrc -clipsrcsql -clipsrclayer -clipsrcwhere -a_srs -a -oo --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_grid gdal_grid
_gdalinfo()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -json -mm -stats -approx_stats -hist -nogcp -nomd -norat -noct -nofl -nonodata -nomask -checksum -listmdd -proj4 -wkt_format -sd -oo -if -mdd --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalinfo gdalinfo
_gdallocationinfo()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -xml -lifonly -valonly -E -field_sep -ignore_extra_input -b -overview -r -l_srs -geoloc -wgs84 -oo --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdallocationinfo gdallocationinfo
_gdalmanage()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalmanage gdalmanage
_gdal_merge()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -o -of -co -ps -tap -separate -q -v -pct -ul_lr -init -n -a_nodata -ot -createonly --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_merge gdal_merge.py
complete -o default -F _gdal_merge gdal_merge
_gdalmove()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -s_srs -et --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalmove gdalmove.py
complete -o default -F _gdalmove gdalmove
_gdal_polygonize()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -q -8 -o -mask -nomask -b -of -lco -overwrite --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_polygonize gdal_polygonize.py
complete -o default -F _gdal_polygonize gdal_polygonize
_gdal_proximity()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -srcband -dstband -of -co -ot -values -distunits -maxdist -nodata -use_input_nodata -fixed-buf-val -q --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_proximity gdal_proximity.py
complete -o default -F _gdal_proximity gdal_proximity
_gdal_rasterize()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -b -i -at -burn -a -3d -add -l -sql -where -dialect -a_nodata -init -a_srs -to -te -tr -ts -tap -optim -co -ot -of --quiet -oo --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_rasterize gdal_rasterize
_gdal_retile()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -v -q -co -of -ps -overlap -ot -tileIndex -tileIndexField -csv -csvDelim -s_srs -pyramidOnly -r -useDirForEachRow -resume --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_retile gdal_retile.py
complete -o default -F _gdal_retile gdal_retile
_gdal_sieve()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -q -st -4 -8 -o -nomask -mask -of --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_sieve gdal_sieve.py
complete -o default -F _gdal_sieve gdal_sieve
_gdalsrsinfo()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help-general --help -h --single-line -V -e -o --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalsrsinfo gdalsrsinfo
_gdaltindex()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -overwrite -recursive -filename_filter -min_pixel_size -max_pixel_size -of -tileindex -write_absolute_path -skip_different_projection -t_srs -src_srs_name -src_srs_format -lyr_name -lco -gti_filename -tr -te -ot -bandcount -nodata -colorinterp -mask -mo -fetch_md --quiet --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdaltindex gdaltindex
_gdaltransform()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -i -s_srs -t_srs -to -s_coord_epoch -t_coord_epoch -ct -order -tps -rpc -geoloc -gcp -output_xy -E -field_sep -ignore_extra_input --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdaltransform gdaltransform
_gdal_translate()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -ot -if -of --quiet -b -mask -expand -strict -not_strict -outsize -tr -ovr -sds -r -scale -scale_X -unscale -exponent -exponent_X -srcwin -projwin -projwin_srs -epo -eco -a_srs -a_coord_epoch -a_ullr -a_nodata -a_gt -a_scale -a_offset -nogcp -gcp -colorinterp -colorinterp_X -stats -approx_stats -norat -noxmp -co -mo -dmo -oo --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_translate gdal_translate
_gdalwarp()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --quiet -overwrite -of -co -s_srs -t_srs -srcalpha -nosrcalpha -dstalpha -tr -ts -te -te_srs -r -ot -wo -multi -s_coord_epoch -t_coord_epoch -ct -tps -rpc -geoloc -order -refine_gcps -to -et -wm -srcnodata -dstnodata -tap -wt -cutline -cutline_srs -cwhere -cl -csql -cblend -crop_to_cutline -nomd -cvmd -setci -oo -doo -ovr -vshift -novshiftgrid -if -srcband -dstband --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdalwarp gdalwarp
_gdal_viewshed()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -of -ox -oy -oz -vv -iv -ov -co -a_nodata -tz -md -j -cc -b -om -os --quiet --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_viewshed gdal_viewshed
_gdal_create()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -ot -of -outsize -bands -burn -a_srs -a_ullr -a_nodata -mo -co --quiet -if --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -ot)
      key_list="Byte Int16 UInt16 UInt32 Int32 Float32 Float64 CInt16 CInt32 CFloat32 CFloat64"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_create gdal_create
_sozip()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --recurse-paths --grow --overwrite --list --validate --optimize-from --quiet --verbose --junk-paths --enable-sozip --sozip-chunk-size --sozip-min-file-size --content-type --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _sozip sozip
_gdal_footprint()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -b -combine_bands -ovr -srcnodata -t_cs -t_srs -split_polys -convex_hull -densify -simplify -min_ring_area -max_points --quiet -oo -of -location_field_name -no_location -write_absolute_path -lco -dsco -lyr_name -overwrite --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -of)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
    --format)
      key_list="$( $tool --formats | tail -n +2 | cut -f 3 -d ' ')"
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      ;;
  esac
  return 0
}
complete -o default -F _gdal_footprint gdal_footprint
_ogr2ogr()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -of -dsco -lco -append -upsert -overwrite -update -sql -dialect -spat -where -select -nln -nlt -s_srs -a_srs -t_srs -addfields -relaxedFieldNameMatch -fieldTypeToString -mapFieldType -fieldmap -splitlistfields -maxsubfields -emptyStrAsNull -forceNullable -unsetFieldWidth -unsetDefault -resolveDomains -dateTimeTo -)<HH> -)<HH>:<MM> -noNativeData -dim -s_coord_epoch -a_coord_epoch -t_coord_epoch -ct -ct_opt -spat_srs -geomfield -segmentize -simplify -makevalid -skipinvalid -wrapdateline -datelineoffset -clipsrc -clipsrcsql -clipsrclayer -clipsrcwhere -clipdst -clipdstsql -clipdstlayer -clipdstwhere -explodecollections -zfield -gcp -tps -order -xyRes -zRes -mRes -unsetCoordPrecision --quiet -progress -if -oo -doo -fid -preserve_fid -unsetFid -skipfailures -gt -limit -ds_transaction -mo -nomd --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _ogr2ogr ogr2ogr
_ogrinfo()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -json -ro -update --quiet -fid -spat -geomfield -where -sql -rl -dialect -al -summary -features -limit -fields -geom -oo -nomd -listmdd -mdd -nocount -noextent -extent3D -nogeomtype -wkt_format -fielddomain -if --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _ogrinfo ogrinfo
_ogrlineref()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general --quiet -progress -of -dsco -lco -create -l -ln -lf -p -pn -pm -pf -r -rn -o -on -s -get_pos -x -y -get_coord -m -get_subline -mb -me --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _ogrlineref ogrlineref
_ogrtindex()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --long-usage --help-general -lnum -lname -of -tileindex -write_absolute_path -skip_different_projection -t_srs -src_srs_name -src_srs_format -accept_different_schemas --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  return 0
}
complete -o default -F _ogrtindex ogrtindex
_ogrmerge()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -f -single -nln -update -append -src_geom_type -dsco -lco -s_srs -t_srs -a_srs -progress -skipfailures -field_strategy -src_layer_field_name -src_layer_field_content --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]/ogrtindex/ogr2ogr}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -f)
      key_list="$( $tool --formats | tail -n +2 | grep -o -E '"[^"]+"' | sed 's/\ /__/')"
      for iter in $key_list; do
        if [[ $iter =~ ^$cur ]]; then
          COMPREPLY+=( "${iter//__/ }" )
        fi
      done
      ;;
  esac
  return 0
}
complete -o default -F _ogrmerge ogrmerge.py
complete -o default -F _ogrmerge ogrmerge
_ogr_layer_algebra()
{
  COMPREPLY=()
  cur="${COMP_WORDS[$COMP_CWORD]}"
  case "$cur" in
    -*)
      key_list="--help --help-general -input_lyr -method_lyr -output_lyr -overwrite -opt -f -dsco -lco -input_fields -method_fields -nlt -a_srs --version --build --license --formats --format --optfile --config --debug --pause --locale "
      if [ "$CURRENT_SHELL" = "bash" ]; then
        mapfile -t COMPREPLY < <(compgen -W "$key_list" -- "$cur")
      else
        COMPREPLY=( "$(compgen -W "$key_list" -- "$cur")" )
      fi
      return 0
      ;;
  esac
  tool=${COMP_WORDS[0]/ogrtindex/ogr2ogr}
  prev="${COMP_WORDS[$COMP_CWORD-1]}"
  case "$prev" in
    -f)
      key_list="$( $tool --formats | tail -n +2 | grep -o -E '"[^"]+"' | sed 's/\ /__/')"
      for iter in $key_list; do
        if [[ $iter =~ ^$cur ]]; then
          COMPREPLY+=( "${iter//__/ }" )
        fi
      done
      ;;
  esac
  return 0
}
complete -o default -F _ogr_layer_algebra ogr_layer_algebra.py
complete -o default -F _ogr_layer_algebra ogr_layer_algebra
