.bash_completion.d/apt-cyg
author Oleksandr Gavenko <gavenkoa@gmail.com>
Tue, 24 Jan 2017 22:14:45 +0200
changeset 815 ccdb84df15b7
child 824 b8ac1e0a719a
permissions -rw-r--r--
Basic completion for apt-cyg.

# -*- mode: sh; sh-shell-file: bash -*-

_apt_cyg()
{
  local _cmds="install remove update download show depends rdepends list listall category listfiles search searchall mirror cache"
  local cur
  cur=${COMP_WORDS[COMP_CWORD]}
  if [[ $COMP_CWORD = 1 ]]; then
      COMPREPLY=( $(compgen -W '$_cmds' -- "$cur") )
      return 0
  fi
  local _cmd=${COMP_WORDS[1]}
  case "$_cmd" in
    install|remove|download|show|depends|rdepends)
      COMPREPLY=( $(apt-cyg listall ^"$cur") )
      return 0 ;;
    update|list|listall|category|listfiles|search|searchall|mirror)
      COMPREPLY=( )
      return 0 ;;
    cache)
      COMPREPLY=( $(compgen -d -- "$cur") )
      return 0 ;;
    *)
      return 1 ;;
  esac
} &&
    complete -F _apt_cyg apt-cyg