#!/usr/bin/env bash
#
# neo4j-admin Bash Completion
# =======================
#
# Bash completion support for the `neo4j-admin` command,
# generated by [picocli](https://picocli.info/) version 4.7.7.
#
# Installation
# ------------
#
# 1. Source all completion scripts in your .bash_profile
#
#   cd $YOUR_APP_HOME/bin
#   for f in $(find . -name "*_completion"); do line=". $(pwd)/$f"; grep "$line" ~/.bash_profile || echo "$line" >> ~/.bash_profile; done
#
# 2. Open a new bash console, and type `neo4j-admin [TAB][TAB]`
#
# 1a. Alternatively, if you have [bash-completion](https://github.com/scop/bash-completion) installed:
#     Place this file in a `bash-completion.d` folder:
#
#   * /etc/bash-completion.d
#   * /usr/local/etc/bash-completion.d
#   * ~/bash-completion.d
#
# Documentation
# -------------
# The script is called by bash whenever [TAB] or [TAB][TAB] is pressed after
# 'neo4j-admin (..)'. By reading entered command line parameters,
# it determines possible bash completions and writes them to the COMPREPLY variable.
# Bash then completes the user input if only one entry is listed in the variable or
# shows the options if more than one is listed in COMPREPLY.
#
# References
# ----------
# [1] http://stackoverflow.com/a/12495480/1440785
# [2] http://tiswww.case.edu/php/chet/bash/FAQ
# [3] https://www.gnu.org/software/bash/manual/html_node/The-Shopt-Builtin.html
# [4] http://zsh.sourceforge.net/Doc/Release/Options.html#index-COMPLETE_005fALIASES
# [5] https://stackoverflow.com/questions/17042057/bash-check-element-in-array-for-elements-in-another-array/17042655#17042655
# [6] https://www.gnu.org/software/bash/manual/html_node/Programmable-Completion.html#Programmable-Completion
# [7] https://stackoverflow.com/questions/3249432/can-a-bash-tab-completion-script-be-used-in-zsh/27853970#27853970
#

if [ -n "$BASH_VERSION" ]; then
  # Enable programmable completion facilities when using bash (see [3])
  shopt -s progcomp
elif [ -n "$ZSH_VERSION" ]; then
  # Make alias a distinct command for completion purposes when using zsh (see [4])
  setopt COMPLETE_ALIASES
  alias compopt=complete

  # Enable bash completion in zsh (see [7])
  # Only initialize completions module once to avoid unregistering existing completions.
  if ! type compdef > /dev/null; then
    autoload -U +X compinit && compinit
  fi
  autoload -U +X bashcompinit && bashcompinit
fi

# CompWordsContainsArray takes an array and then checks
# if all elements of this array are in the global COMP_WORDS array.
#
# Returns zero (no error) if all elements of the array are in the COMP_WORDS array,
# otherwise returns 1 (error).
function CompWordsContainsArray() {
  declare -a localArray
  localArray=("$@")
  local findme
  for findme in "${localArray[@]}"; do
    if ElementNotInCompWords "$findme"; then return 1; fi
  done
  return 0
}
function ElementNotInCompWords() {
  local findme="$1"
  local element
  for element in "${COMP_WORDS[@]}"; do
    if [[ "$findme" = "$element" ]]; then return 1; fi
  done
  return 0
}

# The `currentPositionalIndex` function calculates the index of the current positional parameter.
#
# currentPositionalIndex takes three parameters:
# the command name,
# a space-separated string with the names of options that take a parameter, and
# a space-separated string with the names of boolean options (that don't take any params).
# When done, this function echos the current positional index to std_out.
#
# Example usage:
# local currIndex=$(currentPositionalIndex "mysubcommand" "$ARG_OPTS" "$FLAG_OPTS")
function currentPositionalIndex() {
  local commandName="$1"
  local optionsWithArgs="$2"
  local booleanOptions="$3"
  local previousWord
  local result=0

  for i in $(seq $((COMP_CWORD - 1)) -1 0); do
    previousWord=${COMP_WORDS[i]}
    if [ "${previousWord}" = "$commandName" ]; then
      break
    fi
    if [[ "${optionsWithArgs}" =~ ${previousWord} ]]; then
      ((result-=2)) # Arg option and its value not counted as positional param
    elif [[ "${booleanOptions}" =~ ${previousWord} ]]; then
      ((result-=1)) # Flag option itself not counted as positional param
    fi
    ((result++))
  done
  echo "$result"
}

# compReplyArray generates a list of completion suggestions based on an array, ensuring all values are properly escaped.
#
# compReplyArray takes a single parameter: the array of options to be displayed
#
# The output is echoed to std_out, one option per line.
#
# Example usage:
# local options=("foo", "bar", "baz")
# local IFS=$'\n'
# COMPREPLY=($(compReplyArray "${options[@]}"))
function compReplyArray() {
  declare -a options
  options=("$@")
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local i
  local quoted
  local optionList=()

  for (( i=0; i<${#options[@]}; i++ )); do
    # Double escape, since we want escaped values, but compgen -W expands the argument
    printf -v quoted %q "${options[i]}"
    quoted=\'${quoted//\'/\'\\\'\'}\'

    optionList[i]=$quoted
  done

  # We also have to add another round of escaping to $curr_word.
  curr_word=${curr_word//\\/\\\\}
  curr_word=${curr_word//\'/\\\'}

  # Actually generate completions.
  local IFS=$'\n'
  echo -e "$(compgen -W "${optionList[*]}" -- "$curr_word")"
}

# Bash completion entry point function.
# _complete_neo4j-admin finds which commands and subcommands have been specified
# on the command line and delegates to the appropriate function
# to generate possible options and subcommands for the last specified subcommand.
function _complete_neo4j-admin() {
  # Edge case: if command line has no space after subcommand, then don't assume this subcommand is selected (remkop/picocli#1468).
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} version" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} help" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} backup" ];    then _picocli_neo4j-admin; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database help" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database -h" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database --help" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database check" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database dump" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database import" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database info" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database load" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database migrate" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database upload" ];    then _picocli_neo4j-admin_database; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database import full" ];    then _picocli_neo4j-admin_database_import; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} database import help" ];    then _picocli_neo4j-admin_database_import; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms help" ];    then _picocli_neo4j-admin_dbms; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms -h" ];    then _picocli_neo4j-admin_dbms; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms --help" ];    then _picocli_neo4j-admin_dbms; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms set-default-admin" ];    then _picocli_neo4j-admin_dbms; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} dbms set-initial-password" ];    then _picocli_neo4j-admin_dbms; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server help" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server -h" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server --help" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server console" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server memory-recommendation" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server migrate-configuration" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server report" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server restart" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server start" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server status" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server stop" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server unbind" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} server validate-config" ];    then _picocli_neo4j-admin_server; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} backup help" ];    then _picocli_neo4j-admin_backup; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} backup -h" ];    then _picocli_neo4j-admin_backup; return $?; fi
  if [ "${COMP_LINE}" = "${COMP_WORDS[0]} backup --help" ];    then _picocli_neo4j-admin_backup; return $?; fi

  # Find the longest sequence of subcommands and call the bash function for that subcommand.
  local cmds0=(version)
  local cmds1=(help)
  local cmds2=(database)
  local cmds3=(dbms)
  local cmds4=(server)
  local cmds5=(backup)
  local cmds6=(database help)
  local cmds7=(database -h)
  local cmds8=(database --help)
  local cmds9=(database check)
  local cmds10=(database dump)
  local cmds11=(database import)
  local cmds12=(database info)
  local cmds13=(database load)
  local cmds14=(database migrate)
  local cmds15=(database upload)
  local cmds16=(database import full)
  local cmds17=(database import help)
  local cmds18=(dbms help)
  local cmds19=(dbms -h)
  local cmds20=(dbms --help)
  local cmds21=(dbms set-default-admin)
  local cmds22=(dbms set-initial-password)
  local cmds23=(server help)
  local cmds24=(server -h)
  local cmds25=(server --help)
  local cmds26=(server console)
  local cmds27=(server memory-recommendation)
  local cmds28=(server migrate-configuration)
  local cmds29=(server report)
  local cmds30=(server restart)
  local cmds31=(server start)
  local cmds32=(server status)
  local cmds33=(server stop)
  local cmds34=(server unbind)
  local cmds35=(server validate-config)
  local cmds36=(backup help)
  local cmds37=(backup -h)
  local cmds38=(backup --help)

  if CompWordsContainsArray "${cmds38[@]}"; then _picocli_neo4j-admin_backup_help; return $?; fi
  if CompWordsContainsArray "${cmds37[@]}"; then _picocli_neo4j-admin_backup_h; return $?; fi
  if CompWordsContainsArray "${cmds36[@]}"; then _picocli_neo4j-admin_backup_help; return $?; fi
  if CompWordsContainsArray "${cmds35[@]}"; then _picocli_neo4j-admin_server_validateconfig; return $?; fi
  if CompWordsContainsArray "${cmds34[@]}"; then _picocli_neo4j-admin_server_unbind; return $?; fi
  if CompWordsContainsArray "${cmds33[@]}"; then _picocli_neo4j-admin_server_stop; return $?; fi
  if CompWordsContainsArray "${cmds32[@]}"; then _picocli_neo4j-admin_server_status; return $?; fi
  if CompWordsContainsArray "${cmds31[@]}"; then _picocli_neo4j-admin_server_start; return $?; fi
  if CompWordsContainsArray "${cmds30[@]}"; then _picocli_neo4j-admin_server_restart; return $?; fi
  if CompWordsContainsArray "${cmds29[@]}"; then _picocli_neo4j-admin_server_report; return $?; fi
  if CompWordsContainsArray "${cmds28[@]}"; then _picocli_neo4j-admin_server_migrateconfiguration; return $?; fi
  if CompWordsContainsArray "${cmds27[@]}"; then _picocli_neo4j-admin_server_memoryrecommendation; return $?; fi
  if CompWordsContainsArray "${cmds26[@]}"; then _picocli_neo4j-admin_server_console; return $?; fi
  if CompWordsContainsArray "${cmds25[@]}"; then _picocli_neo4j-admin_server_help; return $?; fi
  if CompWordsContainsArray "${cmds24[@]}"; then _picocli_neo4j-admin_server_h; return $?; fi
  if CompWordsContainsArray "${cmds23[@]}"; then _picocli_neo4j-admin_server_help; return $?; fi
  if CompWordsContainsArray "${cmds22[@]}"; then _picocli_neo4j-admin_dbms_setinitialpassword; return $?; fi
  if CompWordsContainsArray "${cmds21[@]}"; then _picocli_neo4j-admin_dbms_setdefaultadmin; return $?; fi
  if CompWordsContainsArray "${cmds20[@]}"; then _picocli_neo4j-admin_dbms_help; return $?; fi
  if CompWordsContainsArray "${cmds19[@]}"; then _picocli_neo4j-admin_dbms_h; return $?; fi
  if CompWordsContainsArray "${cmds18[@]}"; then _picocli_neo4j-admin_dbms_help; return $?; fi
  if CompWordsContainsArray "${cmds17[@]}"; then _picocli_neo4j-admin_database_import_help; return $?; fi
  if CompWordsContainsArray "${cmds16[@]}"; then _picocli_neo4j-admin_database_import_full; return $?; fi
  if CompWordsContainsArray "${cmds15[@]}"; then _picocli_neo4j-admin_database_upload; return $?; fi
  if CompWordsContainsArray "${cmds14[@]}"; then _picocli_neo4j-admin_database_migrate; return $?; fi
  if CompWordsContainsArray "${cmds13[@]}"; then _picocli_neo4j-admin_database_load; return $?; fi
  if CompWordsContainsArray "${cmds12[@]}"; then _picocli_neo4j-admin_database_info; return $?; fi
  if CompWordsContainsArray "${cmds11[@]}"; then _picocli_neo4j-admin_database_import; return $?; fi
  if CompWordsContainsArray "${cmds10[@]}"; then _picocli_neo4j-admin_database_dump; return $?; fi
  if CompWordsContainsArray "${cmds9[@]}"; then _picocli_neo4j-admin_database_check; return $?; fi
  if CompWordsContainsArray "${cmds8[@]}"; then _picocli_neo4j-admin_database_help; return $?; fi
  if CompWordsContainsArray "${cmds7[@]}"; then _picocli_neo4j-admin_database_h; return $?; fi
  if CompWordsContainsArray "${cmds6[@]}"; then _picocli_neo4j-admin_database_help; return $?; fi
  if CompWordsContainsArray "${cmds5[@]}"; then _picocli_neo4j-admin_backup; return $?; fi
  if CompWordsContainsArray "${cmds4[@]}"; then _picocli_neo4j-admin_server; return $?; fi
  if CompWordsContainsArray "${cmds3[@]}"; then _picocli_neo4j-admin_dbms; return $?; fi
  if CompWordsContainsArray "${cmds2[@]}"; then _picocli_neo4j-admin_database; return $?; fi
  if CompWordsContainsArray "${cmds1[@]}"; then _picocli_neo4j-admin_help; return $?; fi
  if CompWordsContainsArray "${cmds0[@]}"; then _picocli_neo4j-admin_version; return $?; fi

  # No subcommands were specified; generate completions for the top-level command.
  _picocli_neo4j-admin; return $?;
}

# Generates completions for the options and subcommands of the `neo4j-admin` command.
function _picocli_neo4j-admin() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="version help database dbms server backup"
  local flag_opts="'--expand-commands' '--verbose' '-h' '--help' '-V' '--version'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `version` subcommand.
function _picocli_neo4j-admin_version() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="version database dbms server backup"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `database` subcommand.
function _picocli_neo4j-admin_database() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="help -h --help check dump import info load migrate upload"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `dbms` subcommand.
function _picocli_neo4j-admin_dbms() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="help -h --help set-default-admin set-initial-password"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `server` subcommand.
function _picocli_neo4j-admin_server() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="help -h --help console memory-recommendation migrate-configuration report restart start status stop unbind validate-config"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `backup` subcommand.
function _picocli_neo4j-admin_backup() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="help -h --help"
  local flag_opts=""
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_database_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="check dump import info load migrate upload"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `-h` subcommand.
function _picocli_neo4j-admin_database_h() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="check dump import info load migrate upload"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `--help` subcommand.
function _picocli_neo4j-admin_database_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="check dump import info load migrate upload"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `check` subcommand.
function _picocli_neo4j-admin_database_check() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--force' '--check-indexes' '--check-graph' '--check-counts' '--check-property-owners'"
  local arg_opts="'--additional-config' '--report-path' '--max-off-heap-memory' '--threads' '--from-path-data' '--from-path-txn' '--from-path' '--temp-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--report-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--max-off-heap-memory')
      return
      ;;
    '--threads')
      return
      ;;
    '--from-path-data')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--from-path-txn')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--from-path')
      return
      ;;
    '--temp-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `dump` subcommand.
function _picocli_neo4j-admin_database_dump() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--to-stdout' '--overwrite-destination'"
  local arg_opts="'--additional-config' '--to-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--to-path')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `import` subcommand.
function _picocli_neo4j-admin_database_import() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="full help"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `info` subcommand.
function _picocli_neo4j-admin_database_info() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--format'"
  local arg_opts="'--additional-config' '--from-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--from-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `load` subcommand.
function _picocli_neo4j-admin_database_load() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--from-stdin' '--overwrite-destination' '--info'"
  local arg_opts="'--additional-config' '--from-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--from-path')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `migrate` subcommand.
function _picocli_neo4j-admin_database_migrate() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--force-btree-indexes-to-range'"
  local arg_opts="'--additional-config' '--to-format' '--pagecache' '--max-off-heap-memory'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--to-format')
      return
      ;;
    '--pagecache')
      return
      ;;
    '--max-off-heap-memory')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `upload` subcommand.
function _picocli_neo4j-admin_database_upload() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--overwrite-destination'"
  local arg_opts="'--additional-config' '--from-path' '--to-uri' '--to-user' '--to-password' '--to'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--from-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--to-uri')
      return
      ;;
    '--to-user')
      return
      ;;
    '--to-password')
      return
      ;;
    '--to')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `full` subcommand.
function _picocli_neo4j-admin_database_import_full() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--ignore-extra-columns' '--ignore-empty-strings' '--trim-strings' '--legacy-style-quoting' '--skip-bad-entries-logging' '--skip-bad-relationships' '--strict' '--skip-duplicate-nodes' '--normalize-types' '--auto-skip-subsequent-headers' '--overwrite-destination'"
  local arg_opts="'--additional-config' '--schema' '--report-file' '--id-type' '--input-encoding' '--multiline-fields' '--multiline-fields-format' '--delimiter' '--array-delimiter' '--vector-delimiter' '--quote' '--read-buffer-size' '--max-off-heap-memory' '--high-parallel-io' '--threads' '--bad-tolerance' '--nodes' '--relationships' '--input-type' '--temp-path' '--format'"
  local stringintegeractual_option_args=("STRING" "INTEGER" "ACTUAL") # --id-type values
  local v1v2_option_args=("V1" "V2") # --multiline-fields-format values
  local onoffauto_option_args=("ON" "OFF" "AUTO") # --high-parallel-io values
  local csvparquet_option_args=("CSV" "PARQUET") # --input-type values

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--schema')
      return
      ;;
    '--report-file')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--id-type')
      local IFS=$'\n'
      COMPREPLY=( $( compReplyArray "${stringintegeractual_option_args[@]}" ) )
      return $?
      ;;
    '--input-encoding')
      return
      ;;
    '--multiline-fields')
      return
      ;;
    '--multiline-fields-format')
      local IFS=$'\n'
      COMPREPLY=( $( compReplyArray "${v1v2_option_args[@]}" ) )
      return $?
      ;;
    '--delimiter')
      return
      ;;
    '--array-delimiter')
      return
      ;;
    '--vector-delimiter')
      return
      ;;
    '--quote')
      return
      ;;
    '--read-buffer-size')
      return
      ;;
    '--max-off-heap-memory')
      return
      ;;
    '--high-parallel-io')
      local IFS=$'\n'
      COMPREPLY=( $( compReplyArray "${onoffauto_option_args[@]}" ) )
      return $?
      ;;
    '--threads')
      return
      ;;
    '--bad-tolerance')
      return
      ;;
    '--nodes')
      return
      ;;
    '--relationships')
      return
      ;;
    '--input-type')
      local IFS=$'\n'
      COMPREPLY=( $( compReplyArray "${csvparquet_option_args[@]}" ) )
      return $?
      ;;
    '--temp-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--format')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_database_import_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="full"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_dbms_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="set-default-admin set-initial-password"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `-h` subcommand.
function _picocli_neo4j-admin_dbms_h() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="set-default-admin set-initial-password"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `--help` subcommand.
function _picocli_neo4j-admin_dbms_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="set-default-admin set-initial-password"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `set-default-admin` subcommand.
function _picocli_neo4j-admin_dbms_setdefaultadmin() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts="'--additional-config'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `set-initial-password` subcommand.
function _picocli_neo4j-admin_dbms_setinitialpassword() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--require-password-change'"
  local arg_opts="'--additional-config'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_server_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="console memory-recommendation migrate-configuration report restart start status stop unbind validate-config"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `-h` subcommand.
function _picocli_neo4j-admin_server_h() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="console memory-recommendation migrate-configuration report restart start status stop unbind validate-config"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `--help` subcommand.
function _picocli_neo4j-admin_server_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands="console memory-recommendation migrate-configuration report restart start status stop unbind validate-config"
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `console` subcommand.
function _picocli_neo4j-admin_server_console() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `memory-recommendation` subcommand.
function _picocli_neo4j-admin_server_memoryrecommendation() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--docker'"
  local arg_opts="'--additional-config' '--memory'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--memory')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `migrate-configuration` subcommand.
function _picocli_neo4j-admin_server_migrateconfiguration() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts="'--from-path' '--to-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--from-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--to-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `report` subcommand.
function _picocli_neo4j-admin_server_report() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands' '--list' '--ignore-disk-space-check'"
  local arg_opts="'--additional-config' '--database' '--to-path'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
    '--database')
      return
      ;;
    '--to-path')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `restart` subcommand.
function _picocli_neo4j-admin_server_restart() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts="'--shutdown-timeout'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--shutdown-timeout')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `start` subcommand.
function _picocli_neo4j-admin_server_start() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `status` subcommand.
function _picocli_neo4j-admin_server_status() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `stop` subcommand.
function _picocli_neo4j-admin_server_stop() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts="'--shutdown-timeout'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--shutdown-timeout')
      return
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `unbind` subcommand.
function _picocli_neo4j-admin_server_unbind() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}
  local prev_word=${COMP_WORDS[COMP_CWORD-1]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts="'--additional-config'"

  type compopt &>/dev/null && compopt +o default

  case ${prev_word} in
    '--additional-config')
      local IFS=$'\n'
      type compopt &>/dev/null && compopt -o filenames
      COMPREPLY=( $( compgen -f -- "${curr_word}" ) ) # files
      return $?
      ;;
  esac

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `validate-config` subcommand.
function _picocli_neo4j-admin_server_validateconfig() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'--verbose' '-h' '--help' '--expand-commands'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `help` subcommand.
function _picocli_neo4j-admin_backup_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `-h` subcommand.
function _picocli_neo4j-admin_backup_h() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Generates completions for the options and subcommands of the `--help` subcommand.
function _picocli_neo4j-admin_backup_help() {
  # Get completion data
  local curr_word=${COMP_WORDS[COMP_CWORD]}

  local commands=""
  local flag_opts="'-h' '--help'"
  local arg_opts=""

  if [[ "${curr_word}" == -* ]]; then
    COMPREPLY=( $(compgen -W "${flag_opts} ${arg_opts}" -- "${curr_word}") )
  else
    local positionals=""
    local IFS=$'\n'
    COMPREPLY=( $(compgen -W "${commands// /$'\n'}${IFS}${positionals}" -- "${curr_word}") )
  fi
}

# Define a completion specification (a compspec) for the
# `neo4j-admin`, `neo4j-admin.sh`, and `neo4j-admin.bash` commands.
# Uses the bash `complete` builtin (see [6]) to specify that shell function
# `_complete_neo4j-admin` is responsible for generating possible completions for the
# current word on the command line.
# The `-o default` option means that if the function generated no matches, the
# default Bash completions and the Readline default filename completions are performed.
complete -F _complete_neo4j-admin -o default neo4j-admin neo4j-admin.sh neo4j-admin.bash
