Hiding sub-menus?

I’ve been updating many of my older modules using the Restrict Commands trait, so that right-click command menus are more context-based, and commands will only show up when appropriate. For example, piece setup commands will only show up at game start, battle-type commands only show up in battle, etc. This makes long command menus a lot easier to use, because unnecessary commands aren’t shown.

The drawback is that if the hidden commands are organized into Sub-menus, the sub-menu headers will still show. So is there a way to also hide sub-menus? It actually becomes a little confusing when the commands on a sub-menu are all hidden, but the sub-menu header isn’t–to a user, it looks like something is broken or missing.

if it’s not currently possible to set conditions for hiding a sub-menu, this would be a nice enhancement for either the Restrict Commands trait or for the Sub-menu trait.