diff options
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/analyze.go | 8 | ||||
-rw-r--r-- | cmd/build.go | 22 | ||||
-rw-r--r-- | cmd/root.go | 16 |
3 files changed, 23 insertions, 23 deletions
diff --git a/cmd/analyze.go b/cmd/analyze.go index 33c7ac1..077e99c 100644 --- a/cmd/analyze.go +++ b/cmd/analyze.go @@ -1,12 +1,12 @@ package cmd import ( - "github.com/spf13/cobra" "fmt" - "os" + "github.com/fatih/color" + "github.com/spf13/cobra" "github.com/wagoodman/dive/image" "github.com/wagoodman/dive/ui" - "github.com/fatih/color" + "os" ) // analyze takes a docker image tag, digest, or id and displayes the @@ -20,4 +20,4 @@ func analyze(cmd *cobra.Command, args []string) { color.New(color.Bold).Println("Analyzing Image") manifest, refTrees := image.InitializeData(userImage) ui.Run(manifest, refTrees) -}
\ No newline at end of file +} diff --git a/cmd/build.go b/cmd/build.go index 6c94939..485534c 100644 --- a/cmd/build.go +++ b/cmd/build.go @@ -1,23 +1,23 @@ package cmd import ( - "github.com/spf13/cobra" - "os/exec" - "os" - "strings" - "io/ioutil" log "github.com/sirupsen/logrus" + "github.com/spf13/cobra" "github.com/wagoodman/dive/image" "github.com/wagoodman/dive/ui" + "io/ioutil" + "os" + "os/exec" + "strings" ) // buildCmd represents the build command var buildCmd = &cobra.Command{ - Use: "build", - Short: "Build and analyze a docker image", - Long: `Build and analyze a docker image`, + Use: "build", + Short: "Build and analyze a docker image", + Long: `Build and analyze a docker image`, DisableFlagParsing: true, - Run: doBuild, + Run: doBuild, } func init() { @@ -48,7 +48,7 @@ func doBuild(cmd *cobra.Command, args []string) { } // runDockerCmd runs a given Docker command in the current tty -func runDockerCmd(cmdStr string, args... string) error { +func runDockerCmd(cmdStr string, args ...string) error { allArgs := cleanArgs(append([]string{cmdStr}, args...)) @@ -70,4 +70,4 @@ func cleanArgs(s []string) []string { } } return r -}
\ No newline at end of file +} diff --git a/cmd/root.go b/cmd/root.go index 5ef24c2..1e85094 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,11 +2,11 @@ package cmd import ( "fmt" - "os" "github.com/mitchellh/go-homedir" + log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" - log "github.com/sirupsen/logrus" + "os" ) var cfgFile string @@ -15,9 +15,9 @@ var cfgFile string var rootCmd = &cobra.Command{ Use: "dive", Short: "Docker Image Visualizer & Explorer", - Long: `Docker Image Visualizer & Explorer`, - Args: cobra.ExactArgs(1), - Run: analyze, + Long: `Docker Image Visualizer & Explorer`, + Args: cobra.ExactArgs(1), + Run: analyze, } // Execute adds all child commands to the root command and sets flags appropriately. @@ -73,7 +73,7 @@ func initLogging() { // TODO: clean this up and make more configurable var filename string = "dive.log" // create the log file if doesn't exist. And append to it if it already exists. - f, err := os.OpenFile(filename, os.O_WRONLY | os.O_APPEND | os.O_CREATE, 0644) + f, err := os.OpenFile(filename, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644) Formatter := new(log.TextFormatter) Formatter.DisableTimestamp = true log.SetFormatter(Formatter) @@ -81,8 +81,8 @@ func initLogging() { if err != nil { // cannot open log file. Logging to stderr fmt.Println(err) - }else{ + } else { log.SetOutput(f) } log.Debug("Starting Dive...") -}
\ No newline at end of file +} |