File: haxe.bash-completion

package info (click to toggle)
haxe 1%3A3.2.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,464 kB
  • ctags: 9,612
  • sloc: ml: 83,200; ansic: 1,724; makefile: 473; java: 349; cs: 314; python: 250; sh: 43; cpp: 39; xml: 25
file content (99 lines) | stat: -rw-r--r-- 3,557 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# -*- shell-script -*-
# haxe(1) bash-completion specification.
# Put in the public domain 2008 by Jens Peter Secher.

# Inputs:
#   $1 -- name of the command whose arguments are being completed
#   $2 -- word being completed
#   $3 -- word preceding the word being completed
#   $COMP_LINE  -- current command line
#   $COMP_PONT  -- cursor position
#   $COMP_WORDS -- array containing individual words in the current
#                  command line
#   $COMP_CWORD -- index into ${COMP_WORDS} of the word containing the
#                  current cursor position
# Output:
#   COMPREPLY array variable contains possible completions

_haxe()
{
    local cur prev options firstchar
    COMPREPLY=()
    cur=${COMP_WORDS[COMP_CWORD]}
    prev=${COMP_WORDS[COMP_CWORD-1]}
    ## All available options to haxe.
    options='-cp -js -as3 -swf -as3 -neko -php -cpp -xml -main -lib \
             -D -v -debug -swf-version -swf-header -swf-lib -x -resource
             -prompt -cmd --flash-strict --no-traces \
             --flash-use-stage --neko-source --gen-hx-classes --next \
             --display --no-output --times --no-inline --no-opt \
             --php-front --php-lib --js-namespace --remap 
             --interp --macro --dead-code-elimination -help --help'
    case $prev in
	-cp|-as3)
            COMPREPLY=( $( compgen -o dirnames -- ${cur} ) )
            ;;
	-js)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.js" ) )
            ;;
	-swf)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.swf" ) )
            ;;
	-swf-lib|-resource)
            COMPREPLY=( $( compgen -o filenames -- ${cur} ) )
            ;;
	-neko)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.n" ) )
            ;;
	-php|--php-front)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.php" ) )
            ;;
	--php-lib)
            COMPREPLY=( $( compgen -o filenames -- ${cur} ) )
            ;;
	-cpp)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*" ) )
            ;;
	-xml)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.xml" ) )
            ;;
	--gen-hx-classes)
            COMPREPLY=( $( compgen -o filenames -G "${cur}*.hx" ) )
            ;;
        -swf-version)
	    local swf_versions='6 7 8 9 10 10.1 10.2'
	    COMPREPLY=( $( compgen -W "${swf_versions}" -- ${cur} ) )
	    ;;
        -swf-header)
            ## An improvement here would be to restrict to n:n:n:c.
            ;;
        -main)
            ## An improvement here would be to find class Xxx in *.hx
            ## files, alternatively just Xxx.hx.
            ;;
        -lib)
            ## Complete on installed haxelibs.
            if haxelib list 2>&1 > /dev/null; then
                local libraries=`haxelib list | sed 's/:.*//g'`
                COMPREPLY=( $( compgen -W "${libraries}" -- ${cur} ) )
            fi
            ;;
        -D)
            ## An improvement here would be to grep in hx files after #if xxx.
            ;;
	*)
            ## The previous commandline argument is not an option that
            ## needs a value, so look at current argument.  If first
            ## character is a dash, complete on options, otherwise do
            ## normal shell completion.
            firstchar=`expr substr "${cur}" 1 1`
            if [ "$firstchar" = "-" ]; then
	        COMPREPLY=( $( compgen -W "${options}" -- ${cur} ) )
            else
	        COMPREPLY=( $( compgen -o default -- ${cur} ) )
            fi
	    ;;
    esac
    return 0
}
complete -F _haxe -o filenames haxe