Added test for CLI.

CLI now has a "testing mode" to allow for skipping the normal exit
routine.