MCPcopy
hub / github.com/docker/compose / pluginMain

Function pluginMain

cmd/main.go:37–79  ·  cmd/main.go::pluginMain
()

Source from the content-addressed store, hash-verified

35)
36
37func pluginMain() {
38 plugin.Run(
39 func(cli command.Cli) *cobra.Command {
40 backendOptions := &commands.BackendOptions{
41 Options: []compose.Option{
42 compose.WithPrompt(prompt.NewPrompt(cli.In(), cli.Out()).Confirm),
43 },
44 }
45
46 cmd := commands.RootCommand(cli, backendOptions)
47 cmd.AddCommand(commands.HooksCommand())
48 originalPreRunE := cmd.PersistentPreRunE
49 cmd.PersistentPreRunE = func(cmd *cobra.Command, args []string) error {
50 // initialize the cli instance
51 if err := plugin.PersistentPreRunE(cmd, args); err != nil {
52 return err
53 }
54 if err := cmdtrace.Setup(cmd, cli, os.Args[1:]); err != nil {
55 logrus.Debugf("failed to enable tracing: %v", err)
56 }
57
58 if originalPreRunE != nil {
59 return originalPreRunE(cmd, args)
60 }
61 return nil
62 }
63
64 cmd.SetFlagErrorFunc(func(c *cobra.Command, err error) error {
65 return dockercli.StatusError{
66 StatusCode: 1,
67 Status: err.Error(),
68 }
69 })
70 return cmd
71 },
72 metadata.Metadata{
73 SchemaVersion: "0.1.0",
74 Vendor: "Docker Inc.",
75 Version: internal.Version,
76 },
77 command.WithUserAgent("compose/"+internal.Version),
78 )
79}
80
81func main() {
82 if plugin.RunningStandalone() {

Callers 1

mainFunction · 0.85

Calls 6

WithPromptFunction · 0.92
NewPromptFunction · 0.92
SetupFunction · 0.92
ErrorMethod · 0.80
InMethod · 0.45
OutMethod · 0.45

Tested by

no test coverage detected