#!/bin/bash

_dropshell_completions() {
    local cur
    COMPREPLY=()
    cur="${COMP_WORDS[COMP_CWORD]}"
    
    # call dropshell to get the list of possiblities for the current argument. Supply all previous arguments.
    local completions=($(dropshell autocomplete "${COMP_WORDS[@]:1:${COMP_CWORD}-1}"))
    COMPREPLY=( $(compgen -W "${completions[*]}" -- ${cur}) )
    return 0
}

# Register the completion function
complete -F _dropshell_completions dropshell 
complete -F _dropshell_completions ds 