#!/bin/bash

_slpkg_completion()
{
    local cur prev words cword

    COMPREPLY=()
    _get_comp_words_by_ref -n ":" cur prev words cword

    # Call the separate, lightweight Python helper script
    # Pass cword and the entire COMP_WORDS array to it
    COMPREPLY=( $(python3 /usr/libexec/slpkg/shell_completion.py "$cword" "${words[@]}") )

    return 0
}

complete -F _slpkg_completion slpkg
