PageRenderTime 77ms CodeModel.GetById 72ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bash_completion.d/iconv

http://github.com/brinkman83/bashrc
#! | 35 lines | 29 code | 6 blank | 0 comment | 0 complexity | cb5cc2d364bdebc8b5d47d1b076954b9 MD5 | raw file
 1# iconv(1) completion
 2
 3have iconv &&
 4_iconv()
 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        -@(f|t|-@(from|to)-code))
14            COMPREPLY=( $( compgen -W \
15                '$( iconv --list | sed -e "s@//@@;" )' -- "$cur" ) )
16            return 0
17            ;;
18    esac
19
20
21    if [[ "$cur" = -* ]]; then
22        COMPREPLY=( $( compgen -W '--from-code -f --to-code -t --list
23            --output -o --verbose' -- "$cur" ) )
24        return 0
25    fi
26} &&
27complete -F _iconv $default iconv
28
29# Local variables:
30# mode: shell-script
31# sh-basic-offset: 4
32# sh-indent-comment: t
33# indent-tabs-mode: nil
34# End:
35# ex: ts=4 sw=4 et filetype=sh