fix(completion): support subcommands that have multiple dashes

Dashes are not supported in function names and underscores were not
automatically translated. Replace all dashes of the current completion
token, if it is an arg which allows subcommands to use underscores
instead of dashes to declare their completion handlers.

Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
This commit is contained in:
Levente Polyak 2023-12-22 21:04:23 +01:00
parent d0dc0e1a32
commit 8f45c65830
No known key found for this signature in database
GPG Key ID: FC1B547C8D8172C8
1 changed files with 1 additions and 1 deletions

View File

@ -295,7 +295,7 @@ _handle_subcommands() {
fi
;;
args)
local service_sub=${service_name}_$line[1]
local service_sub=${service_name}_${line[1]//-/_}
if typeset -p ${service_sub}_args &> /dev/null; then
local cmd_args=${service_sub}_args[@]
_arguments -s "${(P)cmd_args}"