refactor, clean up and break out cli options into function

Sorry about the diff. It's hard to see what happened because I got rid of indentation and at the same time reordered functions so the order in .h and .cc match. Probably easier if you just check ldb.h and ldb.cc manually.

Main goal is to try and keep the main() function super clean and start breaking out into functions. The functions can more easily be extracted into separate files later on. So should be easier to do https://github.com/hij1nx/ldb/issues/4