# Auto-generated by MIRTK root CMakeLists.txt during CMake configure.
#
# To enable Bash completion for "docker run [options] <user>/mirtk" subcommands:
#
# - On Linux:
#   - Copy this file to /etc/bash_completion.d/:
#
# - On OS X with Homebrew:
#   - brew install bash-completion
#   - curl -L https://raw.githubusercontent.com/docker/docker/master/contrib/completion/bash/docker > $(brew --prefix)/etc/bash_completion.d/docker
#   - Copy this file to $(brew --prefix)/etc/bash_completion.d/:
#
_docker_mirtk()
{
  local commands='deform-mesh recon-neonatal-cortex calculate-boundary-map calculate-surface-map calculate-volume-map compose-maps evaluate-surface-map evaluate-volume-map calculate-filtering calculate-gradients change-label measure-volume padding fill-holes fill-holes-nn-based em draw-em em-hard-segmentation kmeans normalize split-labels help-rst info aggregate-images average-images calculate-element-wise calculate-distance-map calculate-exponential-map calculate-lie-bracket calculate-logarithmic-map close-image combine-images convert-image cut-brain detect-edges dilate-image downsample-image edit-image erode-image evaluate-overlap extract-connected-components extract-image-region extract-image-slice extract-image-volume flip-image match-histogram open-image reflect-image resample-image smooth-image subdivide-brain-image evaluate-similarity average-measure average-overlap register construct-atlas evaluate-atlas edit-dof invert-dof average-dofs bisect-dof compose-dofs convert-dof evaluate-dof evaluate-jacobian init-dof transform-image calculate-surface-attributes calculate-surface-spectrum close-scalars copy-pointset-attributes decimate-surface delete-pointset-attributes dilate-scalars erode-scalars evaluate-cardiac-motion evaluate-distance evaluate-distortion evaluate-surface-mesh evaluate-surface-overlap extract-connected-points offset-surface open-scalars project-onto-surface remesh-surface smooth-surface blend-surface convert-mris convert-pointset extract-pointset-cells extract-pointset-surface extract-surface merge-surfaces transform-points match-points'
  local noreply='true'
  local nodocker='false'
  if [ $COMP_CWORD -gt 2 ] && [ ${COMP_WORDS[1]} = run ]; then
    local i
    let i=$COMP_CWORD-1
    if [ ${COMP_WORDS[i]/*\//} = mirtk ]; then
      COMPREPLY=( `compgen -W "help help-rst $commands" -- ${COMP_WORDS[COMP_CWORD]}` )
      nodocker='true'
      noreply='false'
    elif [ ${COMP_WORDS[i]} = help ]; then
      let i=$i-1
      if [ ${COMP_WORDS[i]/*\//} = mirtk ]; then
        COMPREPLY=( `compgen -W "$commands" -- ${COMP_WORDS[COMP_CWORD]}` )
        nodocker='true'
        noreply='false'
      fi
    else
      local word
      for word in ${COMP_WORDS[@]}; do
        if [ ${word/*\//} = mirtk ]; then
          nodocker='true'
          noreply='true'
        fi
      done
    fi
  fi
  if [ $nodocker = false ]; then
    # call docker completion function instead
    # https://raw.githubusercontent.com/docker/docker/master/contrib/completion/bash/docker
    declare -f _docker > /dev/null
    if [ $? -eq 0 ]; then
      _docker
      noreply='false'
    fi
  fi
  if [ $noreply = true ]; then
    local IFS=$'
'
    COMPREPLY=(`compgen -o plusdirs -f -- "${COMP_WORDS[COMP_CWORD]}"`)
    compopt -o filenames +o nospace 2>/dev/null || compgen -f /non-existing-dir/ > /dev/null
  fi
}
complete -F _docker_mirtk docker