Basic completion for apt-cyg.
authorOleksandr Gavenko <gavenkoa@gmail.com>
Tue, 24 Jan 2017 22:14:45 +0200
changeset 815 ccdb84df15b7
parent 814 83aaaf45479a
child 816 bbadb46574c4
Basic completion for apt-cyg.
.bash_completion.d/apt-cyg
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.bash_completion.d/apt-cyg	Tue Jan 24 22:14:45 2017 +0200
@@ -0,0 +1,27 @@
+# -*- 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