MCPcopy Index your code
hub / github.com/docker/cli / newCreateCommand

Function newCreateCommand

cli/command/plugin/create.go:67–88  ·  view source on GitHub ↗
(dockerCLI command.Cli)

Source from the content-addressed store, hash-verified

65}
66
67func newCreateCommand(dockerCLI command.Cli) *cobra.Command {
68 options := pluginCreateOptions{}
69
70 cmd := &cobra.Command{
71 Use: "create [OPTIONS] PLUGIN PLUGIN-DATA-DIR",
72 Short: "Create a plugin from a rootfs and configuration. Plugin data directory must contain config.json and rootfs directory.",
73 Args: cli.RequiresMinArgs(2),
74 RunE: func(cmd *cobra.Command, args []string) error {
75 options.repoName = args[0]
76 options.context = args[1]
77 return runCreate(cmd.Context(), dockerCLI, options)
78 },
79 ValidArgsFunction: cobra.NoFileCompletions, // TODO(thaJeztah): should provide "directory" completion for the second arg
80 DisableFlagsInUseLine: true,
81 }
82
83 flags := cmd.Flags()
84
85 flags.BoolVar(&options.compress, "compress", false, "Compress the context using gzip")
86
87 return cmd
88}
89
90func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error {
91 if err := validateTag(options.repoName); err != nil {

Callers 7

TestCreateErrorsFunction · 0.70
TestCreatePluginFunction · 0.70
newPluginCommandFunction · 0.70

Calls 1

runCreateFunction · 0.70

Tested by 6

TestCreateErrorsFunction · 0.56
TestCreatePluginFunction · 0.56

Used in the wild real call sites across dependent graphs

searching dependent graphs…