Refactor to support testing Also add tests Signed-off-by: Daniel Nephin <dnephin@docker.com> Upstream-commit: e828efa4ab Component: cli
e828efa4ab