pip
authorOleksandr Gavenko <gavenkoa@gmail.com>
Fri, 20 Feb 2015 00:23:29 +0200
changeset 728 9e3ca6ea7d28
parent 727 42d012e9ede1
child 729 3808bb55f8bb
pip
.bash_completion.d/pip
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.bash_completion.d/pip	Fri Feb 20 00:23:29 2015 +0200
@@ -0,0 +1,91 @@
+# -*- mode: sh; sh-shell-file: bash -*-
+
+_pip()
+{
+  local _cmds='install uninstall freeze list show search wheel help'
+  local _acts='switch ignore wipe backup'
+  local _opts='-h --help -v --verbose -V --version -q --quiet --proxy --timeout'
+  local _index_opts='-i --index-url --extra-index-url --no-index -f --find-links --allow-external --allow-all-external --allow-unverified --process-dependency-links'
+  local _install_opts='-e --editable -U --upgrade --force-reinstall -I --ignore-installed --no-deps --no-install --no-download \
+--install-option --user --egg --compile --no-compile --no-use-wheel --pre --no-clean \
+-e --editable -b --build -t --target -d --download --download-cache \
+-r --requirement'
+  local _uninstall_opts='-y --yes -r --requirement'
+  local _list_opts='-o --outdated -u --uptodate -e --editable -l --local --pre'
+  local _freeze_opts='-f --find-links -l --local'
+  local _search_opts='--index'
+  local _show_opts='--index'
+  local _wheel_opts='--no-use-wheel --build-option --no-deps --global-option --pre --no-clean \
+-w --wheel-dir --download-cache -b --build
+-r, --requirement'
+  local cur
+  cur=${COMP_WORDS[COMP_CWORD]}
+  if [[ $COMP_CWORD = 1 ]]; then
+    COMPREPLY=( $(compgen -W '$_cmds'  -- "$cur") )
+    return 0
+  fi
+  local first prev
+  first=${COMP_WORDS[1]}
+  prev=${COMP_WORDS[COMP_CWORD-1]}
+  case "$prev" in
+    --cert|--log|--log-file)
+      COMPREPLY=( $(compgen -d -- "$cur") )
+      return 0 ;;
+    --exists-action)
+      COMPREPLY=( $(compgen -W  '$_acts' -- "$cur") )
+      return 0 ;;
+  esac
+  case $first in
+    install)
+      case $prev in
+        -e|--editable|-b|--build|-t|--target|-d|--download|--download-cache)
+          COMPREPLY=( $(compgen -d -- "$cur") )
+          return 0 ;;
+        -r|--requirement)
+          COMPREPLY=( $(compgen -f -- "$cur") )
+          return 0 ;;
+      esac
+      COMPREPLY=( $(compgen -W '$_install_opts $_opts $_index_opts'  -- "$cur") )
+      return 0 ;;
+    uninstall)
+      case $prev in
+        -r|--requirement)
+          COMPREPLY=( $(compgen -f -- "$cur") )
+          return 0 ;;
+      esac
+      COMPREPLY=( $(compgen -W '$_uninstall_opts $_opts'  -- "$cur") )
+      return 0 ;;
+    list)
+      COMPREPLY=( $(compgen -W '$_list_opts $_opts $_index_opts'  -- "$cur") )
+      return 0 ;;
+    freeze)
+      case $prev in
+        -r|--requirement)
+          COMPREPLY=( $(compgen -f -- "$cur") )
+          return 0 ;;
+      esac
+      COMPREPLY=( $(compgen -W '$_freeze_opts $_opts'  -- "$cur") )
+      return 0 ;;
+    search)
+      COMPREPLY=( $(compgen -W '$_search_opts $_opts'  -- "$cur") )
+      return 0 ;;
+    show)
+      COMPREPLY=( $(compgen -W '$_show_opts $_opts'  -- "$cur") )
+      return 0 ;;
+    wheel)
+      case $prev in
+        -w|--wheel-dir|--download-cache|-b|--build)
+          COMPREPLY=( $(compgen -d -- "$cur") )
+          return 0 ;;
+        -r|--requirement)
+          COMPREPLY=( $(compgen -f -- "$cur") )
+          return 0 ;;
+      esac
+      COMPREPLY=( $(compgen -W '$_wheel_opts $_opts $_index_opts'  -- "$cur") )
+      return 0 ;;
+  esac
+  COMPREPLY=( $(compgen -W '$_opts'  -- "$cur") )
+  return 0
+} &&
+    complete -F _pip pip pip2 pip2.5 pip2.6 pip2.7 pip2.8
+