cmd

package
v0.2.1-0...-c5bc52b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2017 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "To analyze a single image: [image].  To compare two images: [image1] [image2]",
	Short: "Analyze a single image or compare two images.",
	Long:  `Analyzes a single image or compares two images using the specifed analyzers/differs as indicated via flags (see documentation for available ones).`,
	Run: func(cmd *cobra.Command, args []string) {
		if validArgs, err := validateArgs(args); !validArgs {
			glog.Error(err.Error())
			os.Exit(1)
		}

		utils.SetDockerEngine(eng)

		analyzeArgs := []string{}
		allAnalyzers := getAllAnalyzers()
		for _, name := range allAnalyzers {
			if *analyzeFlagMap[name] == true {
				analyzeArgs = append(analyzeArgs, name)
			}
		}

		if len(analyzeArgs) == 0 {
			analyzeArgs = allAnalyzers
		}

		var err error

		if len(args) == 1 {
			err = analyzeImage(args[0], analyzeArgs)
		} else {
			err = diffImages(args[0], args[1], analyzeArgs)
		}

		if err != nil {
			glog.Error(err)
			os.Exit(1)
		}
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL