Skip to main content

mr note-block update-state

Replace a block's state payload. Takes the block ID as a positional argument and the new state as --state JSON. state is separate from content: it holds runtime/UI state like which todo items are checked, which gallery layout is selected, or a calendar's current view. The shape depends on the block's type (see note-block types for default state schemas). Sending null or an empty body returns an error: the state column has a NOT NULL constraint.

Usage

mr note-block update-state <id>

Positional arguments:

  • <id>

Examples

Mark a text block as "done" via a custom state field

mr note-block update-state 42 --state '{"done":true}'

Check off a todo item (todos blocks use {"checked":[itemId,...]})

mr note-block update-state 42 --state '{"checked":["task-1"]}'

Flags

FlagTypeDefaultDescription
--statestring{}Block state JSON (required) (required)

Inherited global flags

FlagTypeDefaultDescription
--jsonboolfalseOutput raw JSON
--no-headerboolfalseOmit table headers
--pageint1Page number for list commands (default page size: 50)
--quietboolfalseOnly output IDs
--serverstringhttp://localhost:8181mahresources server URL (env: MAHRESOURCES_URL)

Output

Updated NoteBlock object with id (uint), noteId (uint), type (string), position (string), content (object), state (object)

Exit Codes

0 on success; 1 on any error

See Also