MCPcopy Create free account
hub / github.com/imgproxy/imgproxy / applyPresetOption

Method applyPresetOption

options/parser/apply.go:541–565  ·  view source on GitHub ↗
(
	ctx context.Context,
	o *options.Options,
	args []string,
	usedPresets ...string,
)

Source from the content-addressed store, hash-verified

539}
540
541func (p *Parser) applyPresetOption(
542 ctx context.Context,
543 o *options.Options,
544 args []string,
545 usedPresets ...string,
546) error {
547 for _, preset := range args {
548 if pr, ok := p.presets[preset]; ok {
549 if slices.Contains(usedPresets, preset) {
550 slog.Warn(fmt.Sprintf("Recursive preset usage is detected: %s", preset))
551 continue
552 }
553
554 options.AppendToSlice(o, keys.UsedPresets, preset)
555
556 if err := p.applyURLOptions(ctx, o, pr, true, append(usedPresets, preset)...); err != nil {
557 return err
558 }
559 } else {
560 return newOptionArgumentError(ctx, "preset", "Unknown preset: %s", preset)
561 }
562 }
563
564 return nil
565}

Callers 3

applyURLOptionMethod · 0.95
parsePathPresetsMethod · 0.95

Calls 4

applyURLOptionsMethod · 0.95
AppendToSliceFunction · 0.92
newOptionArgumentErrorFunction · 0.85
WarnMethod · 0.80

Tested by

no test coverage detected