( ctx context.Context, o *options.Options, key string, allowedTypes []processing.GravityType, args ...string, )
| 308 | } |
| 309 | |
| 310 | func (p *Parser) parseGravityType( |
| 311 | ctx context.Context, |
| 312 | o *options.Options, |
| 313 | key string, |
| 314 | allowedTypes []processing.GravityType, |
| 315 | args ...string, |
| 316 | ) (processing.GravityType, error) { |
| 317 | if err := p.ensureMaxArgs(ctx, key, args, 1); err != nil { |
| 318 | return processing.GravityUnknown, err |
| 319 | } |
| 320 | |
| 321 | gType, ok := processing.GravityTypes[args[0]] |
| 322 | if !ok || !slices.Contains(allowedTypes, gType) { |
| 323 | types := make([]string, len(allowedTypes)) |
| 324 | for i, at := range allowedTypes { |
| 325 | types[i] = at.String() |
| 326 | } |
| 327 | return processing.GravityUnknown, newInvalidArgumentError(ctx, key, args[0], types...) |
| 328 | } |
| 329 | |
| 330 | o.Set(key, gType) |
| 331 | |
| 332 | return gType, nil |
| 333 | } |
| 334 | |
| 335 | func (p *Parser) isGravityOffsetValid( |
| 336 | gravity processing.GravityType, |
no test coverage detected