Full implementation of command line options, executing queries and spool output from cli