Split argument parsing out

Adds additional shell test coverage.

Change-Id: I23eb8ad04f6d9a3f5fdd89fb3d88fe8ee1f91569