Using the following help file example...
menu status {
Animal
.$submenu($animal($1))
}
alias animal {
if ($1 == begin) return -
if ($1 == 1) return Cow:echo Cow
if ($1 == 2) return Llama:echo Llama
if ($1 == 3) return Emu:echo Emu
if ($1 == end) return -
}
I suspect that $submenu works with the following calls as follows:
$animal(begin) - null result ignored
$animal(1) ... (3) - non-null results
$animal(4) - null result indicates end of submenu items
$animal(end) - null result ignored
In the example code provided in this bug report, $subtest(1) returns null indicating that there are no more menu items, thus resulting in an empty menu with an end terminator value of "end : echo -sg cmdfrompopup end" - but A) it is unclear what happens when "begin" or "end" return anything other than "-" - it could provide a standard separator or do nothing or use the text as a separator; and B) it is undefined by the documentation whether a submenu is shown at all (with any separators) if there are zero menu items provided by $subtest(1) being null.