Refactor of #7887

Closes #7887

Thanks @rhatdan for most of the work

@rhatdan I changed behavior for `CmdLogin`, `CmdLogout`, `CmdPs`. Can you double check it's correct?
@jfrazelle You're right that's weird.

Before:
```
$ docker run --pouet
flag provided but not defined: --pouet

Usage: docker run [OPTIONS] IMAGE [COMMAND] [ARG...]
```

After (note that the diagnostic is outputted twice):
```
$ docker run --pouet
flag provided but not defined: --pouet
See 'docker run --help'.
2014/11/05 21:41:23 flag provided but not defined: --pouet
```