Return non-zero for bad or insufficient parameters

This is for #676.

@Renelvon PTAL.
I know I proposed this change, but now I see it implemented an issue suddenly became apparent. Here's the issue: Everything goes fine when the module is invoked from the command line and the `sys.argv` is set up. Now suppose someone else is trying to invoke `main` directly. The only argument that they need to pass is the `command` to execute. But `main` will require a list of 2 arguments, only to reject the first one. This is a bit confusing.

Let's write it properly:

```python
def main(command=None):
    if command is None and len(sys.argv) != 2:
        usage()
        sys.exit(1)
    else:
        command = sys.argv[1]

    if command not in COMMANDS:
    ...
```