.bash_completion.d/apt-cyg
author Oleksandr Gavenko <gavenkoa@gmail.com>
Mon, 03 Jul 2017 22:51:43 +0300
changeset 864 d96d5b0e8d4f
parent 824 b8ac1e0a719a
permissions -rw-r--r--
Added status option.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
815
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     1
# -*- mode: sh; sh-shell-file: bash -*-
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     2
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     3
_apt_cyg()
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     4
{
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     5
  local _cmds="install remove update download show depends rdepends list listall category listfiles search searchall mirror cache"
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     6
  local cur
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     7
  cur=${COMP_WORDS[COMP_CWORD]}
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     8
  if [[ $COMP_CWORD = 1 ]]; then
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
     9
      COMPREPLY=( $(compgen -W '$_cmds' -- "$cur") )
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    10
      return 0
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    11
  fi
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    12
  local _cmd=${COMP_WORDS[1]}
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    13
  case "$_cmd" in
824
b8ac1e0a719a "listall" can benefit from pkg name completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 815
diff changeset
    14
    install|remove|download|show|depends|rdepends|listfiles)
815
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    15
      COMPREPLY=( $(apt-cyg listall ^"$cur") )
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    16
      return 0 ;;
824
b8ac1e0a719a "listall" can benefit from pkg name completion.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents: 815
diff changeset
    17
    update|list|listall|category|search|searchall|mirror)
815
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    18
      COMPREPLY=( )
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    19
      return 0 ;;
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    20
    cache)
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    21
      COMPREPLY=( $(compgen -d -- "$cur") )
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    22
      return 0 ;;
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    23
    *)
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    24
      return 1 ;;
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    25
  esac
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    26
} &&
ccdb84df15b7 Basic completion for apt-cyg.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff changeset
    27
    complete -F _apt_cyg apt-cyg