_abclient() 
{
  local cur prev opts base
  COMPREPLY=()
  cur="${COMP_WORDS[COMP_CWORD]}"
  prev="${COMP_WORDS[COMP_CWORD-1]}"

  #
  #  The basic options we'll complete.
  #
  opts="ls search lscat searchcat cat play newplay export"

  #
  #  Complete the arguments to some of the basic commands.
  #
  case "${prev}" in
    export)
      local names=$(for x in `abclient ls`; do echo ${x} ; done )
      COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
      return 0
    ;;
    play)
      local names=$(for x in `abclient ls`; do echo ${x} ; done )
      COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
      return 0
    ;;
    newplay)
      local names=$(for x in `abclient ls`; do echo ${x} ; done )
      COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
      return 0
    ;;
    cat)
      local names=$(for x in `abclient lscat`; do echo ${x} ; done )
      COMPREPLY=( $(compgen -W "${names}" -- ${cur}) )
      return 0
    ;;
    *)
    ;;
  esac
  COMPREPLY=($(compgen -W "${opts}" -- ${cur}))  
  return 0
}
complete -F _abclient abclient
