How to use code to collapse the selected l layer group in uxp?

This is a really great command! It collapses all group layers in the document, which definitely has utility. If a person just needs to collapse or show a single group, that command is located here.
(I know you know already Pierre, I am including this for easy navigation)