summaryrefslogtreecommitdiffstats
path: root/completions/truncate
blob: 94534a285bcd3d155183fda8087afdf85ade52ed (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
# truncate(1) completion                                   -*- shell-script -*-

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

    local noargopts='!(-*|*[sr]*)'
    # shellcheck disable=SC2254
    case $prev in
        -${noargopts}s | --size | --help | --version)
            return
            ;;
        -${noargopts}r | --reference)
            _comp_compgen_filedir
            return
            ;;
    esac

    [[ $was_split ]] && return

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

    _comp_compgen_filedir
} &&
    complete -F _comp_cmd_truncate truncate

# ex: filetype=sh