(ctx context.Context, o *options.Options, args []string)
| 185 | } |
| 186 | |
| 187 | func (p *Parser) applyTrimOption(ctx context.Context, o *options.Options, args []string) error { |
| 188 | if err := p.ensureMaxArgs(ctx, "trim", args, 4); err != nil { |
| 189 | return err |
| 190 | } |
| 191 | |
| 192 | nArgs := len(args) |
| 193 | |
| 194 | if len(args[0]) > 0 { |
| 195 | if err := p.parseFloat(ctx, o, keys.TrimThreshold, args[0]); err != nil { |
| 196 | return err |
| 197 | } |
| 198 | } else { |
| 199 | o.Delete(keys.TrimThreshold) |
| 200 | } |
| 201 | |
| 202 | if nArgs > 1 && len(args[1]) > 0 { |
| 203 | if err := p.parseHexRGBColor(ctx, o, keys.TrimColor, args[1]); err != nil { |
| 204 | return err |
| 205 | } |
| 206 | } else { |
| 207 | o.Delete(keys.TrimColor) |
| 208 | } |
| 209 | |
| 210 | if nArgs > 2 && len(args[2]) > 0 { |
| 211 | if err := p.parseBool(ctx, o, keys.TrimEqualHor, args[2]); err != nil { |
| 212 | return err |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | if nArgs > 3 && len(args[3]) > 0 { |
| 217 | if err := p.parseBool(ctx, o, keys.TrimEqualVer, args[3]); err != nil { |
| 218 | return err |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | return nil |
| 223 | } |
| 224 | |
| 225 | func (p *Parser) applyRotateOption(ctx context.Context, o *options.Options, args []string) error { |
| 226 | if err := p.parseInt(ctx, o, keys.Rotate, args...); err != nil { |
no test coverage detected