Commit b5ce6939 authored by Matt Butcher's avatar Matt Butcher

feat(*): add target command

parent 8d6007a7
......@@ -39,7 +39,21 @@ func commands() []cli.Command {
},
},
{
Name: "target",
Name: "target",
Usage: "Displays information about cluster.",
ArgsUsage: "",
Action: func(c *cli.Context) {
if err := target(c.Bool("dry-run")); err != nil {
format.Error(err.Error())
os.Exit(1)
}
},
Flags: []cli.Flag{
cli.BoolFlag{
Name: "dry-run",
Usage: "Only display the underlying kubectl commands.",
},
},
},
{
Name: "doctor",
......
package main
import (
"fmt"
"github.com/deis/helm-dm/format"
"github.com/deis/helm-dm/kubectl"
)
func target(dryRun bool) error {
client := kubectl.Client
if dryRun {
client = kubectl.PrintRunner{}
}
out, err := client.ClusterInfo()
if err != nil {
return fmt.Errorf("%s (%s)", out, err)
}
format.Msg(string(out))
return nil
}
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