make command_line creation more pythonic and fix syntax error