cli: factor out output format setup