Expand description
Conditional formatting via spreadsheets.batchUpdate (issue #1793,
ADR-0081 §1).
Three mutating verbs, all gated by DriveOperation::SheetsStructure —
presentational, destroys no data, exactly like format-cells/
set-data-validation. list-conditional-formats is a plain read,
ungated like list-protections — its own module lives entirely in
crate::cli::drive::sheets::conditional_format, this module has no
“list” verb of its own. Shape mirrors format.rs/validation.rs/
protection.rs: compose a target, resolve it against a freshly-fetched
workbook, gate, dry-run, mutate, log.
Index-addressed, not id-addressed. Unlike a crate::drive::sheets::types::ProtectedRange,
a conditional format rule has no stable id — it is one entry of a
crate::drive::sheets::types::Sheet’s ordered conditional_formats
list, and update-conditional-format/delete-conditional-format’s
--index names an ordinal position that shifts when an earlier rule is
deleted. list-conditional-formats exists to make that position
discoverable immediately before acting on it (the same reason
list-protections exists), and --dry-run on update/delete echoes
the rule currently at the given index — both states, “currently” and
“to” — so a stale index is visible before it’s acted on.
A curated condition/rule surface, not full BooleanRule/GradientRule
coverage, mirroring validation.rs’s own stance. FormatCondition
is a separate, smaller enum from validation::Condition — duplicated
rather than shared, since the two surfaces support an overlapping but
different set of condition types: this one drops ONE_OF_LIST/
ONE_OF_RANGE/CHECKBOX (dropdown-only, meaningless for a format
trigger) and adds BLANK/NOT_BLANK (--cell-empty/--cell-not-empty,
meaningful only as a format trigger). GradientRule’s
two endpoints are always anchored MIN/MAX; Sheets also allows an
endpoint anchored at an explicit NUMBER/PERCENT/PERCENTILE value,
which this crate doesn’t build — docs/drive.md names both gaps.
update-conditional-format only replaces the rule at an index; Sheets
also supports moving a rule from one index to another without changing
its content, which this crate doesn’t build either.
Structs§
- Conditional
Format Options - Per-call options.
- Conditional
Format Outcome - The full outcome of one attempt.
- Format
Effect - The mutable subset of a cell’s format a
BooleanRulecan apply. - Gradient
Midpoint - A
GradientRule’s optional midpoint. - Gradient
Spec - A
GradientRulethis crate can build — see the module doc’s gradient cut for what’s deliberately excluded.
Enums§
- Conditional
Format Result - What happened (or, under
--dry-run, would happen). - Conditional
Format Verb - Which mutation to perform.
- Format
Condition - The condition shapes a
BooleanRulecan trigger on. - Format
Rule - The rule content
add-conditional-format/update-conditional-formatbuild — exactly one of a condition-triggered format or a color-scale gradient, matchingConditionalFormatRule’s own union. - Gradient
Point Type - One of Sheets’
GradientRulemidpoint anchor types —MIN/MAXare reserved for the two fixed endpoints and never appear here (see the module doc’s gradient cut).
Functions§
- conditional_
format - Runs one conditional-format mutation, logging every attempt that isn’t a dry run.
- describe
- Renders an outcome as human-readable text.
- describe_
lines - Renders an outcome as its individual lines, none of which contains a newline.