Commit a3166a9c authored by Michelle Noorali's avatar Michelle Noorali

Merge pull request #3 from michelleN/doctor

Doctor
parents c2483f13 5884ff12
package main
import (
"github.com/deis/helm-dm/dm"
"github.com/deis/helm-dm/kubectl"
)
func doctor() error {
var runner kubectl.Runner
runner = &kubectl.RealRunner{}
if dm.IsInstalled(runner) {
format.Success("You have everything you need. Go forth my friend!")
} else {
format.Warning("Looks like you don't have DM installed.\nRun: `helm install`")
}
return nil
}
...@@ -67,7 +67,15 @@ func commands() []cli.Command { ...@@ -67,7 +67,15 @@ func commands() []cli.Command {
}, },
}, },
{ {
Name: "doctor", Name: "doctor",
Usage: "Run a series of checks for necessary prerequisites.",
ArgsUsage: "",
Action: func(c *cli.Context) {
if err := doctor(); err != nil {
format.Error("%s", err)
os.Exit(1)
}
},
}, },
{ {
Name: "deploy", Name: "deploy",
......
...@@ -20,3 +20,13 @@ func Info(msg string, v ...interface{}) { ...@@ -20,3 +20,13 @@ func Info(msg string, v ...interface{}) {
func Msg(msg string, v ...interface{}) { func Msg(msg string, v ...interface{}) {
fmt.Fprintf(os.Stdout, msg, v...) fmt.Fprintf(os.Stdout, msg, v...)
} }
func Success(msg string, v ...interface{}) {
msg = "[Success] " + msg + "\n"
fmt.Fprintf(os.Stdout, msg, v...)
}
func Warning(msg string, v ...interface{}) {
msg = "[Warning] " + msg + "\n"
fmt.Fprintf(os.Stdout, msg, v...)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment