cmd/viewcore: use cobra for flexible command line interface

viewcore has evolved to be a collection of many subcommands
and each subcommand requires a different set of arguments and
flags. Use of Cobra (or other CLI support package) makes it
easy to extend the viewcore tool and also provides better user
experience (support for better help messages, argument validation,
and many more).

One drawback is the extra dependency (
and probably we need to vendor it to make go builder happy.

Cobra is light-weight and requires to import standard packages
and packages in the same repo. It's under Apach2.0 license.

Change-Id: I680e32dcc5f2db31f747b24931129a4c33b0dc9f
Reviewed-by: Keith Randall <>
1 file changed