Move helpers into lib for use in go cli

Signed-off-by: Mike Gehard <mgehard@pivotallabs.com>
Extract message dumping for use in CLI