(ctx context.Context, o *options.Options, args []string)
| 259 | } |
| 260 | |
| 261 | func (p *Parser) applyFormatQualityOption(ctx context.Context, o *options.Options, args []string) error { |
| 262 | argsLen := len(args) |
| 263 | if len(args)%2 != 0 { |
| 264 | return newOptionArgumentError( |
| 265 | ctx, |
| 266 | keys.PrefixFormatQuality, |
| 267 | "Missing %s for: %s", |
| 268 | keys.PrefixFormatQuality, |
| 269 | args[argsLen-1], |
| 270 | ) |
| 271 | } |
| 272 | |
| 273 | for i := 0; i < argsLen; i += 2 { |
| 274 | f, ok := imagetype.GetTypeByName(args[i]) |
| 275 | if !ok { |
| 276 | return newOptionArgumentError(ctx, keys.PrefixFormatQuality, "Invalid image format: %s", args[i]) |
| 277 | } |
| 278 | |
| 279 | if err := p.parseQualityInt(ctx, o, keys.FormatQuality(f), 0, args[i+1]); err != nil { |
| 280 | return err |
| 281 | } |
| 282 | } |
| 283 | |
| 284 | return nil |
| 285 | } |
| 286 | |
| 287 | func (p *Parser) applyMaxBytesOption(ctx context.Context, o *options.Options, args []string) error { |
| 288 | return p.parsePositiveInt(ctx, o, keys.MaxBytes, args...) |
no test coverage detected