File: //usr/share/zsh/site-functions/_mdapt
#compdef mdatp
local -a subcmds
_arguments -C \
'*: :->command'
case $state in
(command)
local size
local curr=1
size=${#words[@]}
if [[ "$words[(($CURRENT-1))]" == "--path" ]] ; then
_alternative \
'files:filename:_files'
else
local ret
local json_command=[
for word in $words; do
[[ $curr -ne 1 ]]
[[ $curr -ne $size ]]
[[ $curr -ne 1 || $curr -ne $size ]]
if [[ $curr -ne 1 && $curr -ne $size ]] ; then
if [[ $curr -ne 2 ]] ; then
json_command+=,
fi
json_command+=\"$word\"
else
if [[ ${word} = --* ]]; then
json_command+=,\"--\"
fi
fi
((curr++))
done
json_command+=]
subcmds=(${(f)"$(mdatp helper --command $json_command --type zsh 2>/dev/null)"})
_describe 'command' subcmds
fi
;;
esac