Exemple #1
0
// ProjectRun runs a given command within a service's container.
func ProjectRun(p project.APIProject, c *cli.Context) error {
	if len(c.Args()) == 0 {
		logrus.Fatal("No service specified")
	}

	serviceName := c.Args()[0]
	commandParts := c.Args()[1:]

	options := options.Run{
		Detached: c.Bool("d"),
	}

	exitCode, err := p.Run(context.Background(), serviceName, commandParts, options)
	if err != nil {
		return cli.NewExitError(err.Error(), 1)
	}
	return cli.NewExitError("", exitCode)
}