Properly parse cmd line and set script type