Remove "Domain | Username | Description" header from Virtualmin CLI if there is nothing to list

This is not that much important, but still seems a bug, that would be nice to fix. When virtualmin CLI command doesn't have any domain to output the header is still printed:

virtualmin list-domains --domain domain.tld --toplevel
Domain                         Username        Description                  
------------------------------ --------------- ------------------------------

IMO, the table header should be output only if there are some results.

Status: 
Active

Comments

I suppose, but what is your use case for this? If you are trying to parse the output from list-domains in a script, it's better to use flags like --multiline or --name-only to get more consistent machine-readable output.

There are many use cases as we are using Virtualmin CLI to automatize lot's of things. We frequently check that or another virtualmin CLI output and often time when we expect an empty result we still get the header and have to use additional scripts to strip it out.

Ok, but this is what the --name-only and --multiline flags are for.

I'm very reluctant to change the output of these commands in major ways, as other users may have already written scripts that DO expect those headers!

Jamie,

We have already found a solution to our use case just by ignoring that header line, so we are ok whatever way you go with this request. However, please understand that general convention in any computer language is to output nothing (empty space) if there is no result for any command. It is really strange to have empty header (and additionally deal with the empty header to strip it out) when there is actually no result for the command itself.