Update cli script to handle cases where a target is not provided.
Added cli unit tests.