summaryrefslogtreecommitdiff
blob: 4d1de8730561d1826cf14b94a4aac5d066c13e77 (plain)
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
# $Header: /var/cvsroot/gentoo-x86/dev-util/source-highlight/files/source-highlight-2.8.bash-completion,v 1.1 2008/02/13 13:24:24 dev-zero Exp $
# completion for source-highlight

_source_highlight()
{
    local cur prev opts 
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    prev="${COMP_WORDS[COMP_CWORD-1]}"

    opts="-h --help -V --version -i --input -o --output -s --src-lang \
    --lang-list --outlang-list -f --out-format -d --doc --no-doc -c --css \
    -T --title -t --tab -H --header -F --footer --style-file --outlang-def \
    --outlang-map --data-dir --output-dir --lang-def --lang-map --show-lang-elements \
    --infer-lang -n --line-number --line-number-ref --gen-references --ctags-file \
    --ctags -v --verbose --statistics --gen-version --check-lang --check-outlang \
    --failsafe -g --debug-langdef --show-regex"

    if [[ "${cur}" == -* || ${COMP_CWORD} -eq 1 ]] ; then
	COMPREPLY=($(compgen -W "${opts}" -- "${cur}"))
	return 0
    fi

    case "${prev}" in
	-T|--title|-t|--tab|--gen-references)
	    COMPREPLY=()
	    ;;
	-i|--input|-o|--output|-c|--css|-H|--header|-F|--footer|--style-file|--outlang-def|--outlang-map|--lang-def|--lang-map|--show-lang-elements|--ctags-file|--check-lang|--check-outlang|--show-regex)
	    COMPREPLY=($(compgen -A file -- "${cur}"))
	    ;;
	-s|--src-lang)
	    COMPREPLY=($(compgen -W "C H am bib bison c caml cc changelog cls cpp cs csh csharp css \
		diff docbook dtx eps flex fortran h hh hpp htm html java javascript js ksh l lang \
		langdef latex lex lgt ll log logtalk lua m4 ml mli outlang pas pascal patch perl php php3 php4 php5 \
		pl pm postscript prolog ps py python rb ruby sh shell sig sl slang slsh sml sql sty style syslog tcl tcsh \
		tex tk txt xhtml xml y yacc yy" -- "${cur}"))
	    ;;
	-f|--out-format)
	    COMPREPLY=($(compgen -W "docbook docbook-doc esc esc-doc html html-css html-css-doc html-doc htmltable\
	    javadoc latex latex-doc latexcolor latexcolor-doc texinfo xhtml xhtml-css xhtml-css-doc xhtml-doc xhtmltable" -- "${cur}"))
	    ;;
	--data-dir|--output-dir)
	    COMPREPLY=($(compgen -A directory -- "${cur}"))
	    ;;
	*)
	    COMPREPLY=($(compgen -W "${opts/${preprev}}" -- "${cur}"))
	    ;;
    esac
}
complete -F _source_highlight source-highlight

# vim: set ft=sh tw=80 sw=4 et :