Got the --no-input working.

Wow, it is a big monster commit. That's the nature of the original patch
and, more accurately, the necessary changes/fixes it required elsewhere
in the code. Adding optparse requires a couple of changes but it is
absolutely good