(options Options, start, end int64, tabID string)
| 276 | } |
| 277 | |
| 278 | func buildParagraphStyleRequest(options Options, start, end int64, tabID string) (*docs.Request, bool, error) { |
| 279 | style := &docs.ParagraphStyle{} |
| 280 | var fields []string |
| 281 | |
| 282 | if align := strings.TrimSpace(options.Alignment); align != "" { |
| 283 | resolved, err := formatAlignment(align) |
| 284 | if err != nil { |
| 285 | return nil, false, err |
| 286 | } |
| 287 | style.Alignment = resolved |
| 288 | |
| 289 | fields = append(fields, "alignment") |
| 290 | } |
| 291 | |
| 292 | if options.LineSpacing < 0 { |
| 293 | return nil, false, ValidationError("--line-spacing must be positive") |
| 294 | } |
| 295 | |
| 296 | if options.LineSpacing > 0 { |
| 297 | style.LineSpacing = options.LineSpacing |
| 298 | |
| 299 | fields = append(fields, "lineSpacing") |
| 300 | } |
| 301 | |
| 302 | if spacingMode := strings.TrimSpace(options.SpacingMode); spacingMode != "" { |
| 303 | resolved, err := formatSpacingMode(spacingMode) |
| 304 | if err != nil { |
| 305 | return nil, false, err |
| 306 | } |
| 307 | style.SpacingMode = resolved |
| 308 | |
| 309 | fields = append(fields, "spacingMode") |
| 310 | } |
| 311 | |
| 312 | namedStyle, err := formatNamedStyle(options.HeadingLevel, options.NamedStyle) |
| 313 | if err != nil { |
| 314 | return nil, false, err |
| 315 | } |
| 316 | |
| 317 | if namedStyle != "" { |
| 318 | style.NamedStyleType = namedStyle |
| 319 | |
| 320 | fields = append(fields, "namedStyleType") |
| 321 | } |
| 322 | |
| 323 | addDimension := func(value *float64, flag, field string, apply func(*docs.Dimension)) error { |
| 324 | if value == nil { |
| 325 | return nil |
| 326 | } |
| 327 | |
| 328 | if *value < 0 { |
| 329 | return invalidf("--%s must be non-negative", flag) |
| 330 | } |
| 331 | |
| 332 | dimension := &docs.Dimension{Magnitude: *value, Unit: "PT"} |
| 333 | if *value == 0 { |
| 334 | dimension.ForceSendFields = append(dimension.ForceSendFields, "Magnitude") |
| 335 | } |
no test coverage detected