use correct exit status code on error
refactored cli module to use if-else and print output and exit on success in one place
added exception handler to do_function block
change query option to be mutually exclusive like the rest
Merge pull request #381 from jbadigital/cli

CLI mods