refactor the print summary part of execute command