Use optparse

This PR refactors the Commandparser class and the commands to use 'optparse'.