Separate error formatting out of cli.GenericMain
Separate error formatting out of cli.GenericMain

This patch moves the error formatting into a separate function that will
be exported so that scripts that execute multiple opcodes can create the
same output as for GenericMain. Also, GenericMain becomes more readable.

Reviewed-by: imsnah


yiannist/ganeti,bitemyapp/ganeti,onponomarev/ganeti,mbakke/ganeti,andir/ganeti,dimara/ganeti,mbakke/ganeti,leshchevds/ganeti,mbakke/ganeti,grnet/snf-ganeti,andir/ganeti,ganeti-github-testing/ganeti-test-1,apyrgio/snf-ganeti,yiannist/ganeti,dimara/ganeti,yiannist/ganeti,leshchevds/ganeti,ganeti/ganeti,andir/ganeti,onponomarev/ganeti,ganeti-github-testing/ganeti-test-1,leshchevds/ganeti,apyrgio/ganeti,ganeti/ganeti,ganeti/ganeti,apyrgio/ganeti,grnet/snf-ganeti,bitemyapp/ganeti,apyrgio/snf-ganeti