1
0
mirror of https://github.com/rancher/os.git synced 2025-08-25 17:59:17 +00:00

Create ros compose command

This commit is contained in:
Darren Shepherd 2015-09-22 11:17:15 -07:00
parent a13e2957e7
commit e25c59f1ab
2 changed files with 58 additions and 0 deletions

View File

@ -60,6 +60,7 @@ func Main() {
Subcommands: tlsConfCommands(),
},
installCommand,
composeCommand(),
}
app.Run(os.Args)

57
cmd/control/compose.go Normal file
View File

@ -0,0 +1,57 @@
package control
import (
"github.com/Sirupsen/logrus"
"github.com/codegangsta/cli"
"github.com/docker/libcompose/cli/command"
dockerApp "github.com/docker/libcompose/cli/docker/app"
"github.com/docker/libcompose/project"
"github.com/rancherio/os/compose"
"github.com/rancherio/os/config"
)
type projectFactory struct {
}
func (p *projectFactory) Create(c *cli.Context) (*project.Project, error) {
cfg, err := config.LoadConfig()
if err != nil {
return nil, err
}
return compose.GetProject(cfg)
}
func beforeApp(c *cli.Context) error {
if c.GlobalBool("verbose") {
logrus.SetLevel(logrus.DebugLevel)
}
return nil
}
func composeCommand() cli.Command {
factory := &projectFactory{}
app := cli.Command{}
app.Name = "compose"
app.Usage = "Command line interface for libcompose."
app.Before = beforeApp
app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
app.Subcommands = []cli.Command{
command.BuildCommand(factory),
command.CreateCommand(factory),
command.UpCommand(factory),
command.StartCommand(factory),
command.LogsCommand(factory),
command.RestartCommand(factory),
command.StopCommand(factory),
command.ScaleCommand(factory),
command.RmCommand(factory),
command.PullCommand(factory),
command.KillCommand(factory),
command.PortCommand(factory),
command.PsCommand(factory),
}
return app
}