forked from docker/libcompose
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.go
77 lines (65 loc) · 2 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
package main
import (
"os"
"path"
cliApp "github.com/docker/libcompose/cli/app"
"github.com/docker/libcompose/cli/command"
dockerApp "github.com/docker/libcompose/cli/docker/app"
"github.com/docker/libcompose/version"
"github.com/urfave/cli"
)
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)
}