open-nomad/e2e/cli/main.go

44 lines
864 B
Go
Raw Normal View History

package main
import (
"os"
2018-07-27 03:11:58 +00:00
hclog "github.com/hashicorp/go-hclog"
"github.com/hashicorp/nomad/e2e/cli/command"
"github.com/mitchellh/cli"
)
const (
NomadE2ECli = "nomad-e2e"
NomadE2ECliVersion = "0.0.1"
)
func main() {
2018-07-27 03:11:58 +00:00
ui := &cli.BasicUi{
Reader: os.Stdin,
Writer: os.Stdout,
ErrorWriter: os.Stderr,
}
logger := hclog.New(&hclog.LoggerOptions{
Name: NomadE2ECli,
Output: &cli.UiWriter{Ui: ui},
2018-07-27 03:11:58 +00:00
})
c := cli.NewCLI(NomadE2ECli, NomadE2ECliVersion)
c.Args = os.Args[1:]
meta := command.NewMeta(ui, logger)
c.Commands = map[string]cli.CommandFactory{
"provision": command.ProvisionCommandFactory(meta),
"run": command.RunCommandFactory(meta),
}
exitStatus, err := c.Run()
if err != nil {
2018-07-27 03:11:58 +00:00
logger.Error("command exited with non-zero status", "status", exitStatus, "error", err)
}
os.Exit(exitStatus)
}