cleanup options and print error if no viz selected

This commit is contained in:
Nate Jones 2014-05-12 20:30:39 -07:00
parent ff57f33a73
commit 66470aa06e

View file

@ -21,7 +21,7 @@ type Image struct {
type ImagesCommand struct { type ImagesCommand struct {
Dot bool `short:"d" long:"dot" description:"Show image information as Graphviz dot."` Dot bool `short:"d" long:"dot" description:"Show image information as Graphviz dot."`
Tree bool `short:"t" long:"tree" description:"Show image information as tree."` Tree bool `short:"t" long:"tree" description:"Show image information as tree."`
NoTruncate bool `short:"n" long:"notrunc" description:"Don't truncate the image IDs."` NoTruncate bool `short:"n" long:"no-trunc" description:"Don't truncate the image IDs."`
} }
var imagesCommand ImagesCommand var imagesCommand ImagesCommand
@ -46,6 +46,8 @@ func (x *ImagesCommand) Execute(args []string) error {
} }
fmt.Printf(jsonToTree(images, startImageArg, imagesCommand.NoTruncate)) fmt.Printf(jsonToTree(images, startImageArg, imagesCommand.NoTruncate))
} else {
return fmt.Errorf("Please specify either --dot or --tree")
} }
return nil return nil