This library, cmdparse, can be used to create such a command line interface. Internally it uses optparse or any other option parser library to parse options and it provides a nice API for specifying commands.

WWW: https://cmdparse.gettalong.org/
