Reorganized cli.js to make it testable.
Now uses an enclosing function to isolate the use strict pragma.
Now uses a top-level object which is exported and which holds all testable functions/properties.
The internal functions now use _ prefixes and can successfully be mocked.
Added tests for all internal functions.
Updated CLI for testability. Added cli.js tests.
Merge remote-tracking branch 'upstream/develop' into develop