| 83 | } |
| 84 | |
| 85 | func addCmdFunc(cmd *cobra.Command, args []string, flags addCmdFlags) error { |
| 86 | box, err := devbox.Open(&devopt.Opts{ |
| 87 | Dir: flags.config.path, |
| 88 | Environment: flags.config.environment, |
| 89 | Stderr: cmd.ErrOrStderr(), |
| 90 | }) |
| 91 | if err != nil { |
| 92 | return errors.WithStack(err) |
| 93 | } |
| 94 | |
| 95 | opts := devopt.AddOpts{ |
| 96 | AllowInsecure: flags.allowInsecure, |
| 97 | DisablePlugin: flags.disablePlugin, |
| 98 | Platforms: flags.platforms, |
| 99 | ExcludePlatforms: flags.excludePlatforms, |
| 100 | Patch: flags.patch, |
| 101 | Outputs: flags.outputs, |
| 102 | } |
| 103 | if flags.patchGlibc { |
| 104 | // Backwards compatibility so --patch-glibc still works. |
| 105 | opts.Patch = "always" |
| 106 | } |
| 107 | return box.Add(cmd.Context(), args, opts) |
| 108 | } |