blob: 937378a05095decf33297e93d728aaf18b8e91d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
package cmd
import (
"fmt"
"github.com/spf13/cobra"
"github.com/wagoodman/dive/runtime"
"github.com/wagoodman/dive/utils"
)
// doAnalyzeCmd takes a docker image tag, digest, or id and displays the
// image analysis to the screen
func doAnalyzeCmd(cmd *cobra.Command, args []string) {
defer utils.Cleanup()
if len(args) == 0 {
printVersionFlag, err := cmd.PersistentFlags().GetBool("version")
if err == nil && printVersionFlag {
printVersion(cmd, args)
return
}
fmt.Println("No image argument given")
_ = cmd.Help()
utils.Exit(1)
}
userImage := args[0]
if userImage == "" {
fmt.Println("No image argument given")
_ = cmd.Help()
utils.Exit(1)
}
initLogging()
runtime.Run(runtime.Options{
ImageId: userImage,
ExportFile: exportFile,
CiConfigFile: ciConfigFile,
})
}
|