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

Function confirmRemoteIncludes

cmd/compose/options.go:257–293  ·  cmd/compose/options.go::confirmRemoteIncludes
(dockerCli command.Cli, options buildOptions, assumeYes bool)

Source from the content-addressed store, hash-verified

255}
256
257func confirmRemoteIncludes(dockerCli command.Cli, options buildOptions, assumeYes bool) error {
258 if assumeYes {
259 return nil
260 }
261
262 var remoteIncludes []string
263 remoteLoaders := options.ProjectOptions.remoteLoaders(dockerCli) //nolint:staticcheck
264 for _, cf := range options.ProjectOptions.ConfigPaths { //nolint:staticcheck
265 for _, loader := range remoteLoaders {
266 if loader.Accept(cf) {
267 remoteIncludes = append(remoteIncludes, cf)
268 break
269 }
270 }
271 }
272
273 if len(remoteIncludes) == 0 {
274 return nil
275 }
276
277 _, _ = fmt.Fprintln(dockerCli.Out(), "\nWarning: This Compose project includes files from remote sources:")
278 for _, include := range remoteIncludes {
279 _, _ = fmt.Fprintf(dockerCli.Out(), " - %s\n", include)
280 }
281 _, _ = fmt.Fprintln(dockerCli.Out(), "\nRemote includes could potentially be malicious. Make sure you trust the source.")
282
283 msg := "Do you want to continue? [y/N]: "
284 confirmed, err := prompt.NewPrompt(dockerCli.In(), dockerCli.Out()).Confirm(msg, false)
285 if err != nil {
286 return err
287 }
288 if !confirmed {
289 return fmt.Errorf("operation cancelled by user")
290 }
291
292 return nil
293}

Callers 2

checksForRemoteStackFunction · 0.85

Calls 6

NewPromptFunction · 0.92
remoteLoadersMethod · 0.80
ConfirmMethod · 0.65
AcceptMethod · 0.45
OutMethod · 0.45
InMethod · 0.45

Tested by 1