#!/bin/zsh
_htmlman () {
NAME=$words[1]
shift words
# echo $words >&2
O=$($NAME --completions $words)
# for some reason the double quotes are necessary to keep empty
# elements from getting deleted
L=("${(f)O}")
P=$L[1]
L=($L[2,-1])
if [[ $P != '' ]]; then
compadd -U -a -P $P -- L
else
compadd -U -a -- L
fi
}
compdef _htmlman htmlman