This splits the logic into a cli, which handles parsing command line args and
reading files, and a terminal abstraction for handling user input and ouput.
All uses of os.Exit are removed in favor of returning errors.
Overall this enables better testing and reuse of code. Previously we had to
rely on external unit testing for CLI tests, which are harder to write tests.
Unfortunately kingpin doesn't support natively support aliased flag names, so
you can supply both --start-tls and --starttls without an error, but that's
just "holding it wrong".
If otherwise unspecified, default to port 443.
If a starttls protocol is given, use a protocol-specific default.
So now "certigo connect squareup.com" works.
This moves two functions out of main.go.
The only change to the functions was to make them take arguments, instead of using global variables in main.
The mysql and psql imports are moved here too.