# From https://raw.github.com/arq5x/bash_completion/master/samtools revision e931a8b46d9582672cc506e45ad9b4f4d6fbd743
_samtools()
{
  local cur prev opts
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD-1]}"
  opts="view sort mpileup depth 
        faidx tview index idxstats 
        fixmate flagstat calmd merge 
        rmdup reheader cat targetcut 
        phase pad2unpad"

  case $prev in
      samtools)
          COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
          ;;
  esac
  return 0
}
complete -F _samtools -o default samtools
