summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorAlex Goodman <wagoodman@gmail.com>2018-10-15 22:51:48 -0400
committerAlex Goodman <wagoodman@gmail.com>2018-10-15 22:51:48 -0400
commit4c99bd093df6a6963d0736f8eb3c1b69ab12ffd8 (patch)
tree302629a0bea583f326aa9c6a6699f7263566557e /cmd
parent4e7e9b64e3cf469b080d1afb1306964f2debd8f0 (diff)
added basic documentation
Diffstat (limited to 'cmd')
-rw-r--r--cmd/analyze.go2
-rw-r--r--cmd/build.go3
-rw-r--r--cmd/root.go2
3 files changed, 6 insertions, 1 deletions
diff --git a/cmd/analyze.go b/cmd/analyze.go
index 9018784..33b3498 100644
--- a/cmd/analyze.go
+++ b/cmd/analyze.go
@@ -8,6 +8,8 @@ import (
"github.com/wagoodman/dive/ui"
)
+// analyze takes a docker image tag, digest, or id and displayes the
+// image analysis to the screen
func analyze(cmd *cobra.Command, args []string) {
userImage := args[0]
if userImage == "" {
diff --git a/cmd/build.go b/cmd/build.go
index be0d4be..6c94939 100644
--- a/cmd/build.go
+++ b/cmd/build.go
@@ -24,6 +24,7 @@ func init() {
rootCmd.AddCommand(buildCmd)
}
+// doBuild implements the steps taken for the build command
func doBuild(cmd *cobra.Command, args []string) {
iidfile, err := ioutil.TempFile("/tmp", "dive.*.iid")
if err != nil {
@@ -46,6 +47,7 @@ func doBuild(cmd *cobra.Command, args []string) {
ui.Run(manifest, refTrees)
}
+// runDockerCmd runs a given Docker command in the current tty
func runDockerCmd(cmdStr string, args... string) error {
allArgs := cleanArgs(append([]string{cmdStr}, args...))
@@ -59,6 +61,7 @@ func runDockerCmd(cmdStr string, args... string) error {
return cmd.Run()
}
+// cleanArgs trims the whitespace from the given set of strings.
func cleanArgs(s []string) []string {
var r []string
for _, str := range s {
diff --git a/cmd/root.go b/cmd/root.go
index 5fce13f..5ef24c2 100644
--- a/cmd/root.go
+++ b/cmd/root.go
@@ -21,7 +21,6 @@ var rootCmd = &cobra.Command{
}
// Execute adds all child commands to the root command and sets flags appropriately.
-// This is called by main.main(). It only needs to happen once to the rootCmd.
func Execute() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
@@ -69,6 +68,7 @@ func initConfig() {
}
}
+// initLogging sets up the loggin object with a formatter and location
func initLogging() {
// TODO: clean this up and make more configurable
var filename string = "dive.log"