~ubuntu-branches/ubuntu/vivid/bash-completion/vivid-proposed

« back to all changes in this revision

Viewing changes to contrib/python

  • Committer: Package Import Robot
  • Author(s): Angel Abad
  • Date: 2011-02-08 09:39:13 UTC
  • mfrom: (5.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20110208093913-89h9hx9eq5j7vjpw
Tags: 1:1.3-1ubuntu1
* Merge from debian unstable. (LP: #715057) Remaining changes:
  - debian/patches/disable-avahi-browse.diff: Disable avahi-browse since
    it scales poorly in the current form:
    + Refresh patch
  - debian/patches/apt-get-changelog.patch:
    + Re-work patch because contrib dir no longer exists in upstream
      distribution.
* Dropped chages, applied upstream:
  - Fix p4 completion
  - Fix typo in openssl completion
  - Fix error while loading service(8) completions

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# bash completion for python
2
 
 
3
 
have python &&
4
 
_python()
5
 
{
6
 
    local prev cur i
7
 
 
8
 
    COMPREPLY=()
9
 
    _get_comp_words_by_ref cur prev
10
 
 
11
 
    case $prev in
12
 
    -Q)
13
 
        COMPREPLY=( $( compgen -W "old new warn warnall" -- "$cur" ) )
14
 
        return 0
15
 
        ;;
16
 
    -W)
17
 
        COMPREPLY=( $( compgen -W "ignore default all module once error" \
18
 
            -- "$cur" ) )
19
 
        return 0
20
 
        ;;
21
 
    -c)
22
 
        _filedir '@(py|pyc|pyo)'
23
 
        return 0
24
 
        ;;
25
 
    !(python|-?))
26
 
        [[ ${COMP_WORDS[COMP_CWORD-2]} != -@(Q|W) ]] && _filedir
27
 
        ;;
28
 
    esac
29
 
 
30
 
 
31
 
    # if '-c' is already given, complete all kind of files.
32
 
    for (( i=0; i < ${#COMP_WORDS[@]}-1; i++ )); do
33
 
        if [[ ${COMP_WORDS[i]} == -c ]]; then
34
 
            _filedir
35
 
        fi
36
 
    done
37
 
 
38
 
 
39
 
    if [[ "$cur" != -* ]]; then
40
 
        _filedir '@(py|pyc|pyo)'
41
 
    else
42
 
        COMPREPLY=( $( compgen -W "- -d -E -h -i -O -Q -S -t -u \
43
 
            -U -v -V -W -x -c" -- "$cur" ) )
44
 
    fi
45
 
 
46
 
 
47
 
 
48
 
    return 0
49
 
} &&
50
 
complete -F _python -o filenames python
51
 
 
52
 
# Local variables:
53
 
# mode: shell-script
54
 
# sh-basic-offset: 4
55
 
# sh-indent-comment: t
56
 
# indent-tabs-mode: nil
57
 
# End:
58
 
# ex: ts=4 sw=4 et filetype=sh