github.com/docker/libcompose@v0.4.1-0.20210616120443-2a046c0bdbf2/cli/main/main.go (about)

     1  package main
     2  
     3  import (
     4  	"os"
     5  	"path"
     6  
     7  	cliApp "github.com/docker/libcompose/cli/app"
     8  	"github.com/docker/libcompose/cli/command"
     9  	dockerApp "github.com/docker/libcompose/cli/docker/app"
    10  	"github.com/docker/libcompose/version"
    11  	"github.com/urfave/cli"
    12  )
    13  
    14  func main() {
    15  	factory := &dockerApp.ProjectFactory{}
    16  
    17  	cli.AppHelpTemplate = `Usage: {{.Name}} {{if .Flags}}[OPTIONS] {{end}}COMMAND [arg...]
    18  
    19  {{.Usage}}
    20  
    21  Version: {{.Version}}{{if or .Author .Email}}
    22  
    23  Author:{{if .Author}}
    24    {{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
    25    {{.Email}}{{end}}{{end}}
    26  {{if .Flags}}
    27  Options:
    28    {{range .Flags}}{{.}}
    29    {{end}}{{end}}
    30  Commands:
    31    {{range .Commands}}{{.Name}}{{with .ShortName}}, {{.}}{{end}}{{ "\t" }}{{.Usage}}
    32    {{end}}
    33  Run '{{.Name}} COMMAND --help' for more information on a command.
    34  `
    35  	cli.CommandHelpTemplate = `Usage: ` + path.Base(os.Args[0]) + ` {{.Name}}{{if .Flags}} [OPTIONS]
    36  
    37  {{.Usage}}
    38  
    39  Options:
    40     {{range .Flags}}{{.}}
    41     {{end}}{{end}}
    42  `
    43  
    44  	app := cli.NewApp()
    45  	app.Name = "libcompose-cli"
    46  	app.Usage = "Command line interface for libcompose."
    47  	app.Version = version.VERSION + " (" + version.GITCOMMIT + ")"
    48  	app.Author = "Docker Compose Contributors"
    49  	app.Email = "https://github.com/docker/libcompose"
    50  	app.Before = cliApp.BeforeApp
    51  	app.Flags = append(command.CommonFlags(), dockerApp.DockerClientFlags()...)
    52  	app.Commands = []cli.Command{
    53  		command.BuildCommand(factory),
    54  		command.ConfigCommand(factory),
    55  		command.CreateCommand(factory),
    56  		command.EventsCommand(factory),
    57  		command.DownCommand(factory),
    58  		command.KillCommand(factory),
    59  		command.LogsCommand(factory),
    60  		command.PauseCommand(factory),
    61  		command.PortCommand(factory),
    62  		command.PsCommand(factory),
    63  		command.PullCommand(factory),
    64  		command.RestartCommand(factory),
    65  		command.RmCommand(factory),
    66  		command.RunCommand(factory),
    67  		command.ScaleCommand(factory),
    68  		command.StartCommand(factory),
    69  		command.StopCommand(factory),
    70  		command.UnpauseCommand(factory),
    71  		command.UpCommand(factory),
    72  		command.VersionCommand(factory),
    73  	}
    74  
    75  	app.Run(os.Args)
    76  
    77  }