summaryrefslogtreecommitdiffstats
path: root/completions/minicom
blob: 752c22e896325410eb4f40f24dd27e3de6992def (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
# bash completion for minicom                              -*- shell-script -*-

_comp_cmd_minicom()
{
    local cur prev words cword was_split comp_args
    _comp_initialize -s -- "$@" || return

    local noargopts='!(-*|*[acSCp]*)'
    # shellcheck disable=SC2254
    case $prev in
        --attrib | --color | -${noargopts}[ac])
            _comp_compgen -- -W 'on off'
            return
            ;;
        --script | --capturefile | -${noargopts}[SC])
            _comp_compgen_filedir
            return
            ;;
        --ptty | -${noargopts}p)
            _comp_expand_glob COMPREPLY '/dev/tty*' &&
                _comp_compgen -- -W '"${COMPREPLY[@]}" "${COMPREPLY[@]#/dev/}"'
            return
            ;;
    esac

    [[ $was_split ]] && return

    if [[ $cur == -* ]]; then
        _comp_compgen_help
        [[ ${COMPREPLY-} == *= ]] && compopt -o nospace
        return
    fi

    local -a files
    _comp_expand_glob files '{/etc/,/etc/minicom/,~/.}minirc.?*' &&
        _comp_compgen -- -W '"${files[@]##*minirc.}"'
} &&
    complete -F _comp_cmd_minicom -o default minicom

# ex: filetype=sh