_manifestfiles()
{
    local cur prev words cword
    _init_completion || return

    local opts="-h --help --data-dir --manifest-file --new-manifest --last-scan --include-meta --include-manifest --missing --create --delete --dry-run --yes --log-level --bundle-dir"

    case "$prev" in
        --new-manifest)
            # FILE is optional: offer paths unless another option is being typed.
            if [[ "$cur" != -* ]]; then
                _filedir '@(yaml|yml)'
                return
            fi
            ;;
        --data-dir)
            _filedir -d
            return
            ;;
        --manifest-file)
            _filedir '@(yaml)'
            return
            ;;
        --create)
            _filedir '@(txt)'
            return
            ;;
    esac

    # Complete long options by default.
    if [[ "$cur" == -* ]]; then
        COMPREPLY=( $(compgen -W "$opts" -- "$cur") )
        return
    fi

    # No other positional arguments are used by manifestfiles.
    COMPREPLY=()
}

complete -F _manifestfiles manifestfiles 
