예제 #1
0
func main() {
	factory := &dockerApp.ProjectFactory{}

	app := cli.NewApp()
	app.Name = "libcompose-cli"
	app.Usage = "Command line interface for libcompose."
	app.Version = version.VERSION + " (" + version.GITCOMMIT + ")"
	app.Author = "Docker Compose Contributors"
	app.Email = "https://github.com/docker/libcompose"
	app.Before = cliApp.BeforeApp
	app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
	app.Commands = []cli.Command{
		command.BuildCommand(factory),
		command.CreateCommand(factory),
		command.DownCommand(factory),
		command.KillCommand(factory),
		command.LogsCommand(factory),
		command.PauseCommand(factory),
		command.PortCommand(factory),
		command.PsCommand(factory),
		command.PullCommand(factory),
		command.RestartCommand(factory),
		command.RmCommand(factory),
		command.RunCommand(factory),
		command.ScaleCommand(factory),
		command.StartCommand(factory),
		command.StopCommand(factory),
		command.UnpauseCommand(factory),
		command.UpCommand(factory),
	}

	app.Run(os.Args)

}
예제 #2
0
파일: service.go 프로젝트: carriercomm/os
func serviceCommand() cli.Command {
	factory := &projectFactory{}

	app := cli.Command{}
	app.Name = "service"
	app.ShortName = "s"
	app.Usage = "Command line interface for services and compose."
	app.Before = beforeApp
	app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
	app.Subcommands = append(serviceSubCommands(),
		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
}
예제 #3
0
func cliMain() {
	factory := &rancherApp.ProjectFactory{}

	app := cli.NewApp()
	app.Name = "rancher-compose"
	app.Usage = "Docker-compose to Rancher"
	app.Version = version.VERSION
	app.Author = "Rancher Labs, Inc."
	app.Email = ""
	app.Before = beforeApp
	app.Flags = append(command.CommonFlags(),
		cli.StringFlag{
			Name: "url",
			Usage: fmt.Sprintf(
				"Specify the Rancher API endpoint URL",
			),
			EnvVar: "RANCHER_URL",
		},
		cli.StringFlag{
			Name: "access-key",
			Usage: fmt.Sprintf(
				"Specify Rancher API access key",
			),
			EnvVar: "RANCHER_ACCESS_KEY",
		},
		cli.StringFlag{
			Name: "secret-key",
			Usage: fmt.Sprintf(
				"Specify Rancher API secret key",
			),
			EnvVar: "RANCHER_SECRET_KEY",
		},
		cli.StringFlag{
			Name:  "rancher-file,r",
			Usage: "Specify an alternate Rancher compose file (default: rancher-compose.yml)",
		},
		cli.StringFlag{
			Name:  "env-file,e",
			Usage: "Specify a file from which to read environment variables",
		},
	)
	app.Commands = []cli.Command{
		rancherApp.CreateCommand(factory),
		rancherApp.UpCommand(factory),
		command.StartCommand(factory),
		command.LogsCommand(factory),
		rancherApp.RestartCommand(factory),
		command.StopCommand(factory),
		command.ScaleCommand(factory),
		command.RmCommand(factory),
		rancherApp.PullCommand(factory),
		rancherApp.UpgradeCommand(factory),
	}

	app.Run(os.Args)
}
예제 #4
0
func main() {
	factory := &dockerApp.ProjectFactory{}

	cli.AppHelpTemplate = `Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...]

{{.Usage}}

Version: {{.Version}}{{if or .Author .Email}}

Author:{{if .Author}}
  {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
  {{.Email}}{{end}}{{end}}
{{if .Flags}}
Options:
  {{range .Flags}}{{.}}
  {{end}}{{end}}
Commands:
  {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
  {{end}}
Run '{{.Name}} COMMAND --help' for more information on a command.
`
	cli.CommandHelpTemplate = `Usage: ` + path.Base(os.Args[0]) + ` {{.Name}}{{if .Flags}} [OPTIONS]

{{.Usage}}

Options:
   {{range .Flags}}{{.}}
   {{end}}{{end}}
`

	app := cli.NewApp()
	app.Name = "libcompose-cli"
	app.Usage = "Command line interface for libcompose."
	app.Version = version.VERSION + " (" + version.GITCOMMIT + ")"
	app.Author = "Docker Compose Contributors"
	app.Email = "https://github.com/docker/libcompose"
	app.Before = cliApp.BeforeApp
	app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
	app.Commands = []cli.Command{
		command.BuildCommand(factory),
		command.ConfigCommand(factory),
		command.CreateCommand(factory),
		command.EventsCommand(factory),
		command.DownCommand(factory),
		command.KillCommand(factory),
		command.LogsCommand(factory),
		command.PauseCommand(factory),
		command.PortCommand(factory),
		command.PsCommand(factory),
		command.PullCommand(factory),
		command.RestartCommand(factory),
		command.RmCommand(factory),
		command.RunCommand(factory),
		command.ScaleCommand(factory),
		command.StartCommand(factory),
		command.StopCommand(factory),
		command.UnpauseCommand(factory),
		command.UpCommand(factory),
		command.VersionCommand(factory),
	}

	app.Run(os.Args)

}