( ctx context.Context, o *options.Options, args []string, usedPresets ...string, )
| 539 | } |
| 540 | |
| 541 | func (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 | } |
no test coverage detected