#compdef yadm
_yadm(){
    local -a _1st_arguments
     _1st_arguments=(
        'help:Display yadm command help'
        'init:Initialize an empty repository'
        'config:Configure a setting'
        'list:List tracked files'
        'alt:Create links for alternates'
        'bootstrap:Execute $HOME/.config/yadm/bootstrap'
        'encrypt:Encrypt files'
        'decrypt:Decrypt files'
        'perms:Fix perms for private files'
        'add:git add'
        'push:git push'
        'pull:git pull'
        'diff:git diff'
        'checkout:git checkout'
        'co:git co'
        'commit:git commit'
        'ci:git ci'
        'status:git status'
        'st:git st'
        'reset:git reset'
        'log:git log'
    )

    local context state line expl
    local -A opt_args

    _arguments '*:: :->subcmds' && return 0

    if (( CURRENT == 1 )); then
        _describe -t commands "yadm commands" _1st_arguments -V1
        return
    fi

    case "$words[1]" in
        *)
            _arguments ':filenames:_files'
        ;;
    esac

}

_yadm "$@"