Add test for cli commands.

Some fixes for the cli commands.
Add test running as Grunt task.