This commit is contained in:
Your Name 2025-04-21 20:00:14 +12:00
parent 2f180c900e
commit 5e21c1a306

View File

@ -9,15 +9,16 @@ _dropshell_completions() {
# List of main commands # List of main commands
opts="help version status servers templates autocomplete_list_servers autocomplete_list_services autocomplete_list_commands run install backup" opts="help version status servers templates autocomplete_list_servers autocomplete_list_services autocomplete_list_commands run install backup"
# add all commands to opts
local commands=($(dropshell autocomplete_list_commands))
opts="${opts} ${commands[*]}"
# If we're completing the first argument, show all commands # If we're completing the first argument, show all commands
if [[ ${COMP_CWORD} -eq 1 ]] ; then if [[ ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) ) COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0 return 0
fi fi
# Get available commands from dropshell
local commands=($(dropshell autocomplete_list_commands))
# Command-specific completions # Command-specific completions
case "${prev}" in case "${prev}" in
status|templates|autocomplete_list_servers|autocomplete_list_services|autocomplete_list_commands) status|templates|autocomplete_list_servers|autocomplete_list_services|autocomplete_list_commands)