MCPcopy Create free account
hub / github.com/docker/compose / composeCommand

Function composeCommand

docs/examples/provider.go:47–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

45}
46
47func composeCommand() *cobra.Command {
48 c := &cobra.Command{
49 Use: "compose EVENT",
50 TraverseChildren: true,
51 }
52 c.PersistentFlags().String("project-name", "", "compose project name") // unused
53
54 var options options
55 upCmd := &cobra.Command{
56 Use: "up",
57 Run: func(_ *cobra.Command, args []string) {
58 up(options, args)
59 },
60 Args: cobra.ExactArgs(1),
61 }
62
63 upCmd.Flags().StringVar(&options.db, "type", "", "Database type (mysql, postgres, etc.)")
64 _ = upCmd.MarkFlagRequired("type")
65 upCmd.Flags().IntVar(&options.size, "size", 10, "Database size in GB")
66 upCmd.Flags().String("name", "", "Name of the database to be created")
67 _ = upCmd.MarkFlagRequired("name")
68
69 downCmd := &cobra.Command{
70 Use: "down",
71 Run: down,
72 Args: cobra.ExactArgs(1),
73 }
74 downCmd.Flags().String("name", "", "Name of the database to be deleted")
75 _ = downCmd.MarkFlagRequired("name")
76
77 stopCmd := &cobra.Command{
78 Use: "stop",
79 Run: stop,
80 Args: cobra.ExactArgs(1),
81 }
82
83 c.AddCommand(upCmd, downCmd, stopCmd)
84 c.AddCommand(metadataCommand(upCmd, downCmd, stopCmd))
85 return c
86}
87
88const lineSeparator = "\n"
89

Callers 1

mainFunction · 0.85

Calls 3

upFunction · 0.85
metadataCommandFunction · 0.85
StringMethod · 0.45

Tested by

no test coverage detected