MCPcopy Create free account
hub / github.com/openclaw/gogcli / parseConditionalFormat

Function parseConditionalFormat

internal/cmd/sheets_conditional.go:220–242  ·  view source on GitHub ↗
(formatJSON, formatMask string, input io.Reader)

Source from the content-addressed store, hash-verified

218}
219
220func parseConditionalFormat(formatJSON, formatMask string, input io.Reader) (*sheets.CellFormat, string, error) {
221 b, err := resolveInlineOrFileBytes(formatJSON, input)
222 if err != nil {
223 return nil, "", usagef("read --format-json: %v", err)
224 }
225 var format sheets.CellFormat
226 if err := sheetsformat.Decode(b, &format); err != nil {
227 return nil, "", usagef("invalid --format-json: %v", err)
228 }
229 formatFields := strings.TrimSpace(formatMask)
230 if formatFields != "" {
231 if sheetsformat.HasBordersTypo(formatFields) {
232 return nil, "", usage(`invalid --format-fields: found "boarders"; use "borders"`)
233 }
234 normalized, formatPaths := sheetsformat.NormalizeMask(formatFields)
235 formatFields = strings.TrimPrefix(normalized, sheetsformat.UserEnteredFormatPrefix+".")
236 formatFields = strings.ReplaceAll(formatFields, ","+sheetsformat.UserEnteredFormatPrefix+".", ",")
237 if err := sheetsformat.ApplyForceSendFields(&format, formatPaths); err != nil {
238 return nil, "", usage(err.Error())
239 }
240 }
241 return &format, formatFields, nil
242}
243
244func sheetsConditionalPlannerError(err error) error {
245 var validationErr sheetsconditional.ValidationError

Callers 1

RunMethod · 0.85

Calls 8

DecodeFunction · 0.92
HasBordersTypoFunction · 0.92
NormalizeMaskFunction · 0.92
ApplyForceSendFieldsFunction · 0.92
resolveInlineOrFileBytesFunction · 0.85
usagefFunction · 0.85
usageFunction · 0.85
ErrorMethod · 0.45

Tested by

no test coverage detected