PageRenderTime 31ms CodeModel.GetById 29ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/xmllint

http://github.com/brinkman83/bashrc
#! | 56 lines | 50 code | 6 blank | 0 comment | 0 complexity | 299b862c3242f719cf970b9b7db1dde3 MD5 | raw file
 1# bash completion for xmllint(1)
 2
 3have xmllint &&
 4_xmllint()
 5{
 6    local cur prev
 7
 8    COMPREPLY=()
 9    cur=`_get_cword`
10    prev=${COMP_WORDS[COMP_CWORD-1]}
11
12    case "$prev" in
13        -o|--output)
14            _filedir
15            return 0
16            ;;
17        --path|--dtdvalidfpi|--maxmem|--encode|--pattern)
18            # argument required but no completions available
19            return 0
20            ;;
21        --dtdvalid)
22            _filedir dtd
23            return 0
24            ;;
25        --relaxng)
26            _filedir rng
27            return 0
28            ;;
29        --schema)
30            _filedir xsd
31            return 0
32            ;;
33        --schematron)
34            _filedir sch
35            return 0
36            ;;
37    esac
38
39    if [[ "$cur" == -* ]]; then
40        COMPREPLY=( $( compgen -W '$( xmllint --help 2>&1 | \
41            sed -ne "s/^[[:space:]]*\(--[^[:space:]:]*\).*/\1/p" ) \
42            -o' -- "$cur" ) )
43        return 0
44    fi
45
46    _filedir '@(*ml|htm|svg)'
47} &&
48complete -F _xmllint $filenames xmllint
49
50# Local variables:
51# mode: shell-script
52# sh-basic-offset: 4
53# sh-indent-comment: t
54# indent-tabs-mode: nil
55# End:
56# ex: ts=4 sw=4 et filetype=sh