(dockerCLI command.Cli)
| 65 | } |
| 66 | |
| 67 | func 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 | |
| 90 | func runCreate(ctx context.Context, dockerCli command.Cli, options pluginCreateOptions) error { |
| 91 | if err := validateTag(options.repoName); err != nil { |
searching dependent graphs…